fix up examples and use build log to get neat messages

This commit is contained in:
ThePhD 2017-12-26 08:04:54 -05:00
parent 3fa176c5ef
commit d05769b80e
11 changed files with 34 additions and 42 deletions

View File

@ -216,6 +216,7 @@ if (TESTS OR TESTS_SINGLE OR EXAMPLES OR TESTS_EXAMPLES)
# # Enable test harness for regular or single tests
if (TESTS OR TESTS_SINGLE OR TESTS_EXAMPLES)
# enable ctest
message(STATUS "Testing enabled...")
enable_testing()
endif()
# # Add tests here

View File

@ -31,24 +31,19 @@ image:
- Visual Studio 2017
- Visual Studio 2015
platform:
- x86
- x64
environment:
matrix:
- LUA_VERSION: 5.3.4
MINGW_VERSION: 6.3.0
PARALLELISM:
- LUA_VERSION: 5.3.4
MINGW_VERSION: 5.3.0
PARALLELISM:
- LUA_VERSION: 5.3.4
PARALLELISM: -- /maxcpucount
- LUA_VERSION: 5.2.4
PARALLELISM: -- /maxcpucount
- LUA_VERSION: 5.1.5
PARALLELISM: -- /maxcpucount
platform:
- x86
- x64
matrix:
allow_failures:
@ -90,11 +85,11 @@ init:
- set arch=
- if "%PLATFORM%"=="x64" (set arch= Win64)
- echo %APPVEYOR_BUILD_WORKER_IMAGE%
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (set CMAKE_GENERATOR=Visual Studio 15 2017%arch%)
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (set CMAKE_GENERATOR=Visual Studio 14 2015%arch%)
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" (set CMAKE_GENERATOR=Visual Studio 12 2013%arch%)
- if "%MINGW_VERSION%"=="5.3.0" (set CMAKE_GENERATOR=Ninja)
- if "%MINGW_VERSION%"=="6.3.0" (set CMAKE_GENERATOR=Ninja)
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (set CMAKE_GENERATOR=Visual Studio 15 2017%arch%&&set parallelism=/maxcpucount&&set logger=/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll")
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (set CMAKE_GENERATOR=Visual Studio 14 2015%arch%&&set parallelism=/maxcpucount&&set logger=/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll")
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" (set CMAKE_GENERATOR=Visual Studio 12 2013%arch%&&set parallelism=/maxcpucount&&set logger=/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll")
- if "%MINGW_VERSION%"=="5.3.0" (set CMAKE_GENERATOR=Ninja%%set build_type=-DCMAKE_BUILD_TYPE=Release)
- if "%MINGW_VERSION%"=="6.3.0" (set CMAKE_GENERATOR=Ninja&&set build_type=-DCMAKE_BUILD_TYPE=Release)
# print out useful information
- ninja --version
- cmake --version
@ -106,10 +101,6 @@ init:
before_build:
- set python_path=C:\Python36
- set mingw_path=
- set build_type=
- set parallelism=
- if "%CMAKE_GENERATOR%"=="MinGW Makefiles" (set build_type=-DCMAKE_BUILD_TYPE=Release)
- if "%CMAKE_GENERATOR%"=="Ninja" (set build_type=-DCMAKE_BUILD_TYPE=Release)
- if "%MINGW_VERSION%"=="5.3.0" (set mingw_path=C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0)
- if "%MINGW_VERSION%"=="6.3.0" ( if "%PLATFORM%"=="x64" (set mingw_path=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1) else ( set mingw_path=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1))
- if "%PLATFORM%"=="x64" (set python_path=C:\Python36-x64)
@ -123,8 +114,8 @@ before_build:
# generates too much debug info for MinGW to handle
# TODO: fix the damn compilation space and time already
build_script:
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (cmake --build . --config Debug %PARALLELISM%)
- cmake --build . --config Release %PARALLELISM%
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (cmake --build . --config Debug -- %parallelism% %logger%)
- cmake --build . --config Release -- %parallelism% %logger%
test_script:
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (ctest -C Debug --output-on-failure)

View File

@ -23,7 +23,7 @@
} \
} while (false)
#else
# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false)
# define m_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false)
# define c_assert(condition) do { (void)sizeof(condition); } while (false)
#endif

View File

@ -35,10 +35,10 @@ int main() {
lua.set_function("mult_by_five", &multiplier::by_five);
// assert that the functions work
lua.script("c_assert(my_add(10, 11) == 21)");
lua.script("c_assert(my_mul(4.5, 10) == 45)");
lua.script("c_assert(mult_by_ten(50) == 500)");
lua.script("c_assert(mult_by_five(10) == 50)");
lua.script("assert(my_add(10, 11) == 21)");
lua.script("assert(my_mul(4.5, 10) == 45)");
lua.script("assert(mult_by_ten(50) == 500)");
lua.script("assert(mult_by_five(10) == 50)");
// using lambdas, functions can have state.
int x = 0;

View File

@ -21,7 +21,7 @@ int main() {
lua.script("print('calling multi_tuple')");
lua.script("print(multi_tuple())");
lua.script("x, y = multi_tuple()");
lua.script("c_assert(x == 10 and y == 'goodbye')");
lua.script("assert(x == 10 and y == 'goodbye')");
auto multi = lua.get<sol::function>("multi_tuple");
int first;

View File

@ -96,7 +96,7 @@ int main() {
lua.script("v = vector.new()\n"
"v = vector.new(12)\n"
"v = vector.new(10, 10)\n"
"c_assert(not v:is_unit())\n");
"assert(not v:is_unit())\n");
// You can even have C++-like member-variable-access
// just pass is public member variables in the same style as functions
@ -108,7 +108,7 @@ int main() {
"assert(not vars.low_gravity)\n"
"vars.low_gravity = true\n"
"local x = vars.low_gravity\n"
"c_assert(x)");
"assert(x)");
std::cout << std::endl;

View File

@ -17,8 +17,8 @@ int main() {
lua.set("y", "hello");
// assert values are as given
lua.script("c_assert(x == 10)");
lua.script("c_assert(y == 'hello')");
lua.script("assert(x == 10)");
lua.script("assert(y == 'hello')");
// basic retrieval of a variable

View File

@ -32,9 +32,9 @@ int main() {
// will error: not enough arguments
//lua.script("x4 = v(1)");
lua.script("c_assert(x == 50)");
lua.script("c_assert(x2 == 600)");
lua.script("c_assert(x3 == 21)");
lua.script("assert(x == 50)");
lua.script("assert(x2 == 600)");
lua.script("assert(x3 == 21)");
lua.script("print(x)"); // 50
lua.script("print(x2)"); // 600
lua.script("print(x3)"); // 21

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2017-12-26 04:26:55.295046 UTC
// This header was generated with sol v2.19.0 (revision acade46)
// Generated 2017-12-26 13:03:03.527337 UTC
// This header was generated with sol v2.19.0 (revision 3fa176c)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2017-12-26 04:26:55.501596 UTC
// This header was generated with sol v2.19.0 (revision acade46)
// Generated 2017-12-26 13:03:03.719432 UTC
// This header was generated with sol v2.19.0 (revision 3fa176c)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP