Fossil SCM

fossil-scm / compat / zlib / contrib / puff / test / tester-cov.cmake
Blame History Raw 59 lines
1
cmake_minimum_required(VERSION 3.12...3.31)
2
3
#CMAKE_ARGV0 = ${CMAKE_COMMAND}
4
#CMAKE_ARGV1 = -P
5
#CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
6
#CMAKE_ARGV3 = "$<TARGET_FILE:puff-test-cov>"
7
#CMAKE_ARGV4 = "${CMAKE_CURRENT_SOURCE_DIR}"
8
#CMAKE_ARGV5 = "${CMAKE_CURRENT_BINARY_DIR}"
9
#CMAKE_ARGV6 = GCOV_EXECUTABLE
10
#CMAKE_ARGV7 = GCOV_EXECUTABLE
11
12
function(puff_cov_test test_string expected_result)
13
execute_process(COMMAND ${CMAKE_ARGV0} -E echo_append ${test_string}
14
COMMAND ${CMAKE_ARGV5}
15
COMMAND ${CMAKE_ARGV3}
16
RESULT_VARIABLE RESULT)
17
18
if(NOT RESULT EQUAL expected_result)
19
message(FATAL_ERROR "Received Exit-Code: ${RESULT}\n"
20
"Expected Exit-Code: ${expected_result}\n"
21
"Test-String: ${test_string}")
22
endif(NOT RESULT EQUAL expected_result)
23
endfunction(puff_cov_test test_string expected_result)
24
25
execute_process(COMMAND ${CMAKE_ARGV3} -w ${CMAKE_ARGV4}/zeros.raw)
26
27
puff_cov_test("04" "2")
28
puff_cov_test("00" "2")
29
puff_cov_test("00 00 00 00 00" "254")
30
puff_cov_test("00 01 00 fe ff" "2")
31
32
execute_process(COMMAND ${CMAKE_ARGV0} -E echo_append "01 01 00 fe ff 0a"
33
COMMAND ${CMAKE_ARGV5}
34
COMMAND ${CMAKE_ARGV3})
35
36
puff_cov_test("02 7e ff ff" "246")
37
puff_cov_test("02" "2")
38
puff_cov_test("04 80 49 92 24 49 92 24 0f b4 ff ff c3 04" "2")
39
puff_cov_test("04 80 49 92 24 49 92 24 71 ff ff 93 11 00" "249")
40
puff_cov_test("04 c0 81 08 00 00 00 00 20 7f eb 0b 00 00" "246")
41
42
execute_process(COMMAND ${CMAKE_ARGV0} -E echo_append "0b 00 00"
43
COMMAND ${CMAKE_ARGV5}
44
COMMAND ${CMAKE_ARGV3})
45
46
puff_cov_test("1a 07" "246")
47
puff_cov_test("0c c0 81 00 00 00 00 00 90 ff 6b 04" "245")
48
49
execute_process(COMMAND ${CMAKE_ARGV3} -f ${CMAKE_ARGV4}/zeros.raw)
50
51
puff_cov_test("fc 00 00" "253")
52
puff_cov_test("04 00 fe ff" "252")
53
puff_cov_test("04 00 24 49" "251")
54
puff_cov_test("04 80 49 92 24 49 92 24 0f b4 ff ff c3 84" "248")
55
puff_cov_test("04 00 24 e9 ff ff" "250")
56
puff_cov_test("04 00 24 e9 ff 6d" "247")
57
58
execute_process(COMMAND ${CMAKE_ARGV6} ${CMAKE_ARGV7} -n puff.c.gcno)
59

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button