Refactored samples for cmake compilation
This commit is contained in:
parent
416b034fe1
commit
496710164e
52 changed files with 95 additions and 49 deletions
|
@ -6,18 +6,30 @@ endif ()
|
|||
include_directories(../include)
|
||||
|
||||
set(SAMPLES
|
||||
signal
|
||||
exit
|
||||
report
|
||||
suites
|
||||
fixtures
|
||||
asserts
|
||||
more-suites
|
||||
long-messages
|
||||
description
|
||||
other-crashes
|
||||
simple
|
||||
theories
|
||||
signal.c
|
||||
exit.c
|
||||
report.c
|
||||
suites.c
|
||||
fixtures.c
|
||||
asserts.c
|
||||
more-suites.c
|
||||
long-messages.c
|
||||
description.c
|
||||
other-crashes.c
|
||||
simple.c
|
||||
theories.c
|
||||
|
||||
signal.cc
|
||||
exit.cc
|
||||
report.cc
|
||||
suites.cc
|
||||
fixtures.cc
|
||||
asserts.cc
|
||||
more-suites.cc
|
||||
long-messages.cc
|
||||
description.cc
|
||||
other-crashes.cc
|
||||
simple.cc
|
||||
)
|
||||
|
||||
set(SCRIPTS
|
||||
|
@ -34,22 +46,15 @@ if (HAVE_PCRE)
|
|||
endif ()
|
||||
|
||||
foreach(sample ${SAMPLES})
|
||||
add_executable(${sample} ${sample}.c)
|
||||
target_link_libraries(${sample} criterion)
|
||||
add_test(${sample} ${sample})
|
||||
set_property(TEST ${sample} PROPERTY
|
||||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
)
|
||||
|
||||
add_executable(${sample}_cpp ${sample}.cc)
|
||||
target_link_libraries(${sample}_cpp criterion)
|
||||
add_test(${sample}_cpp ${sample}_cpp)
|
||||
add_executable(${sample}.bin ${sample})
|
||||
target_link_libraries(${sample}.bin criterion)
|
||||
add_test(${sample} ${sample}.bin)
|
||||
set_property(TEST ${sample} PROPERTY
|
||||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
)
|
||||
|
||||
if (NOT MSVC) # we disable the scripted tests when building with MSVC
|
||||
add_test(${sample}_compare sh ${CMAKE_CURRENT_LIST_DIR}/tests/run_test.sh "${CMAKE_CURRENT_LIST_DIR}" . . ${sample})
|
||||
add_test(${sample}_compare sh ${CMAKE_CURRENT_LIST_DIR}/tests/run_test.sh "${CMAKE_CURRENT_LIST_DIR}" . . ${sample}.bin)
|
||||
set_property(TEST ${sample}_compare PROPERTY
|
||||
ENVIRONMENT "LC_ALL=en_US.utf8"
|
||||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m11[0m: Assertion failed: assert is fatal, expect isn't
|
||||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m12[0m: Assertion failed: This assert runs
|
||||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m9[0m: Assertion failed: assert is fatal, expect isn't
|
||||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m10[0m: Assertion failed: This assert runs
|
||||
[[0;31mFAIL[0m] asserts::base: (0.00s)
|
||||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m20[0m: Assertion failed: The conditions for this test were not met.
|
||||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m18[0m: Assertion failed: The conditions for this test were not met.
|
||||
[[0;31mFAIL[0m] asserts::old_school: (0.00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m6[0;1m | Passing: [0;32m4[0;1m | Failing: [0;31m2[0;1m | Crashing: [0;31m0[0;1m [0m
|
6
samples/asserts.cc.bin.err.expected
Normal file
6
samples/asserts.cc.bin.err.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
[[0;34m----[0m] [0;1masserts.cc[0m:[0;31m9[0m: Assertion failed: assert is fatal, expect isn't
|
||||
[[0;34m----[0m] [0;1masserts.cc[0m:[0;31m10[0m: Assertion failed: This assert runs
|
||||
[[0;31mFAIL[0m] asserts::base: (0.00s)
|
||||
[[0;34m----[0m] [0;1masserts.cc[0m:[0;31m18[0m: Assertion failed: The conditions for this test were not met.
|
||||
[[0;31mFAIL[0m] asserts::old_school: (0.00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m6[0;1m | Passing: [0;32m4[0;1m | Failing: [0;31m2[0;1m | Crashing: [0;31m0[0;1m [0m
|
3
samples/description.cc.bin.err.expected
Normal file
3
samples/description.cc.bin.err.expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[0;34m----[0m] [0;1mdescription.cc[0m:[0;31m4[0m: Assertion failed: 0
|
||||
[[0;31mFAIL[0m] misc::failing: (0.00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m1[0;1m | Passing: [0;32m0[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m0[0;1m [0m
|
4
samples/exit.cc.bin.err.expected
Normal file
4
samples/exit.cc.bin.err.expected
Normal file
|
@ -0,0 +1,4 @@
|
|||
[[0;34m----[0m] [0;1mWarning! The test `exit::unexpected_exit` exited during its setup or teardown.[0m
|
||||
[[0;34m----[0m] [0;1mWarning! The test `exit_with_fixtures::fini_exits` exited during its setup or teardown.[0m
|
||||
[[0;34m----[0m] [0;1mWarning! The test `exit_with_fixtures::init_exits` exited during its setup or teardown.[0m
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m5[0;1m | Passing: [0;32m3[0;1m | Failing: [0;31m2[0;1m | Crashing: [0;31m2[0;1m [0m
|
1
samples/fixtures.cc.bin.err.expected
Normal file
1
samples/fixtures.cc.bin.err.expected
Normal file
|
@ -0,0 +1 @@
|
|||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m1[0;1m | Passing: [0;32m1[0;1m | Failing: [0;31m0[0;1m | Crashing: [0;31m0[0;1m [0m
|
2
samples/fixtures.cc.bin.out.expected
Normal file
2
samples/fixtures.cc.bin.out.expected
Normal file
|
@ -0,0 +1,2 @@
|
|||
Runs before the test
|
||||
Runs after the test
|
6
samples/long-messages.cc.bin.err.expected
Normal file
6
samples/long-messages.cc.bin.err.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
[[0;34m----[0m] [0;1mlong-messages.cc[0m:[0;31m4[0m: Assertion failed: This is
|
||||
[[0;34m----[0m] A long message
|
||||
[[0;34m----[0m] Spawning multiple lines.
|
||||
[[0;34m----[0m] Formatting is respected.
|
||||
[[0;31mFAIL[0m] sample::long_msg: (0.00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m1[0;1m | Passing: [0;32m0[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m0[0;1m [0m
|
0
samples/more-suites.cc.bin.out.expected
Normal file
0
samples/more-suites.cc.bin.out.expected
Normal file
0
samples/other-crashes.c.bin.out.expected
Normal file
0
samples/other-crashes.c.bin.out.expected
Normal file
3
samples/other-crashes.cc.bin.err.expected
Normal file
3
samples/other-crashes.cc.bin.err.expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[0;34m----[0m] [0;1mWarning! The test `misc::setup_crash` crashed during its setup or teardown.[0m
|
||||
[[0;34m----[0m] [0;1mWarning! The test `misc::teardown_crash` crashed during its setup or teardown.[0m
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m2[0;1m | Passing: [0;32m1[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m1[0;1m [0m
|
0
samples/other-crashes.cc.bin.out.expected
Normal file
0
samples/other-crashes.cc.bin.out.expected
Normal file
3
samples/report.cc.bin.err.expected
Normal file
3
samples/report.cc.bin.err.expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[0;34m----[0m] [0;1mreport.cc[0m:[0;31m5[0m: Assertion failed: 0
|
||||
[[0;31mFAIL[0m] sample::test: (0.00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m1[0;1m | Passing: [0;32m0[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m0[0;1m [0m
|
4
samples/report.cc.bin.out.expected
Normal file
4
samples/report.cc.bin.out.expected
Normal file
|
@ -0,0 +1,4 @@
|
|||
criterion_init
|
||||
testing test in category sample
|
||||
Asserts: [1 passed, 1 failed, 2 total]
|
||||
criterion_fini
|
0
samples/signal.c.bin.out.expected
Normal file
0
samples/signal.c.bin.out.expected
Normal file
4
samples/signal.cc.bin.err.expected
Normal file
4
samples/signal.cc.bin.err.expected
Normal file
|
@ -0,0 +1,4 @@
|
|||
[[0;34m----[0m] [0;1msignal.cc[0m:[0;31m16[0m: Unexpected signal caught below this line!
|
||||
[[0;31mFAIL[0m] simple::uncaught: CRASH!
|
||||
[[0;31mFAIL[0m] simple::wrong_signal: (0.00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m3[0;1m | Passing: [0;32m1[0;1m | Failing: [0;31m2[0;1m | Crashing: [0;31m1[0;1m [0m
|
0
samples/signal.cc.bin.out.expected
Normal file
0
samples/signal.cc.bin.out.expected
Normal file
0
samples/simple.c.bin.out.expected
Normal file
0
samples/simple.c.bin.out.expected
Normal file
3
samples/simple.cc.bin.err.expected
Normal file
3
samples/simple.cc.bin.err.expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[0;34m----[0m] [0;1msimple.cc[0m:[0;31m4[0m: Assertion failed: 0
|
||||
[[0;31mFAIL[0m] misc::failing: (0.00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m2[0;1m | Passing: [0;32m1[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m0[0;1m [0m
|
0
samples/simple.cc.bin.out.expected
Normal file
0
samples/simple.cc.bin.out.expected
Normal file
1
samples/suites.c.bin.err.expected
Normal file
1
samples/suites.c.bin.err.expected
Normal file
|
@ -0,0 +1 @@
|
|||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m2[0;1m | Passing: [0;32m2[0;1m | Failing: [0;31m0[0;1m | Crashing: [0;31m0[0;1m [0m
|
0
samples/suites.c.bin.out.expected
Normal file
0
samples/suites.c.bin.out.expected
Normal file
1
samples/suites.cc.bin.err.expected
Normal file
1
samples/suites.cc.bin.err.expected
Normal file
|
@ -0,0 +1 @@
|
|||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m2[0;1m | Passing: [0;32m2[0;1m | Failing: [0;31m0[0;1m | Crashing: [0;31m0[0;1m [0m
|
0
samples/suites.cc.bin.out.expected
Normal file
0
samples/suites.cc.bin.out.expected
Normal file
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
./simple --no-early-exit --always-succeed
|
||||
./theories --no-early-exit --always-succeed
|
||||
./simple.c.bin --no-early-exit --always-succeed
|
||||
./theories.c.bin --no-early-exit --always-succeed
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
./simple --fail-fast --always-succeed
|
||||
./simple.c.bin --fail-fast --always-succeed
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
./simple --help
|
||||
./simple --version
|
||||
./simple.c.bin --help
|
||||
./simple.c.bin --version
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
./simple --list
|
||||
./simple --list --ascii
|
||||
./simple.c.bin --list
|
||||
./simple.c.bin --list --ascii
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/bin/sh -e
|
||||
./simple --pattern '*/passing'
|
||||
./simple --pattern '!(*/passing)'
|
||||
./simple --pattern '[pf]a@(ss|il)ing'
|
||||
./simple --pattern '@(+(nest)ed))'
|
||||
./simple --pattern '?(*(a|b))'
|
||||
! ./simple --pattern '?(malformed'
|
||||
./simple --pattern '[!azerty]assing'
|
||||
./simple --pattern '|pipe'
|
||||
./simple --pattern '\!(escaped'
|
||||
./simple.c.bin --pattern '*/passing'
|
||||
./simple.c.bin --pattern '!(*/passing)'
|
||||
./simple.c.bin --pattern '[pf]a@(ss|il)ing'
|
||||
./simple.c.bin --pattern '@(+(nest)ed))'
|
||||
./simple.c.bin --pattern '?(*(a|b))'
|
||||
! ./simple.c.bin --pattern '?(malformed'
|
||||
./simple.c.bin --pattern '[!azerty]assing'
|
||||
./simple.c.bin --pattern '|pipe'
|
||||
./simple.c.bin --pattern '\!(escaped'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
./simple --tap --always-succeed
|
||||
./signal --tap --always-succeed
|
||||
./asserts --tap --always-succeed
|
||||
./more-suites --tap --always-succeed
|
||||
./long-messages --tap --always-succeed
|
||||
./description --tap --always-succeed
|
||||
./simple.c.bin --tap --always-succeed
|
||||
./signal.c.bin --tap --always-succeed
|
||||
./asserts.c.bin --tap --always-succeed
|
||||
./more-suites.c.bin --tap --always-succeed
|
||||
./long-messages.c.bin --tap --always-succeed
|
||||
./description.c.bin --tap --always-succeed
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
./simple --verbose --always-succeed
|
||||
./simple.c.bin --verbose --always-succeed
|
||||
|
|
Loading…
Add table
Reference in a new issue