Lines Matching +full:test +full:-
1 # SPDX-License-Identifier: Apache-2.0
10 message(STATUS "Run 1 -------------\n CMake PROJECT mode\n----------------------")
12 # Script mode initialization (re-run)
16 message(STATUS "Run 2 ------------\n CMake SCRIPT mode\n---------------------")
39 cmake_parse_arguments(TA_ARG "" "COMMENT" "TEST" ${ARGN})
45 "Test: ${TA_ARG_TEST}\n"
53 yaml_get(actual NAME yaml-test KEY cmake test key-string)
55 test_assert(TEST ${expected} STREQUAL ${actual}
62 yaml_length(actual NAME yaml-test KEY cmake test key-list-string)
63 test_assert(TEST ${expected} EQUAL ${actual}
68 yaml_get(actual NAME yaml-test KEY cmake test key-list-string)
71 test_assert(TEST "${e}" STREQUAL "${a}"
79 yaml_get(actual NAME yaml-test KEY cmake test key-int)
81 test_assert(TEST ${expected} EQUAL ${actual}
88 yaml_length(actual NAME yaml-test KEY cmake test key-list-int)
89 test_assert(TEST ${expected} EQUAL ${actual}
94 yaml_get(actual NAME yaml-test KEY cmake test key-list-int)
97 test_assert(TEST "${e}" STREQUAL "${a}"
105 yaml_get(actual NAME yaml-test KEY cmake test key-int)
107 test_assert(TEST ${expected} EQUAL ${actual}
116 yaml_length(actual_length NAME yaml-test KEY cmake test map-list)
117 yaml_get(actual_name NAME yaml-test KEY cmake test map-list 0 map-entry-name)
118 yaml_get(actual_int NAME yaml-test KEY cmake test map-list 0 map-entry-int)
120 test_assert(TEST ${expected_length} EQUAL ${actual_length}
123 test_assert(TEST ${expected_name} STREQUAL ${actual_name}
126 test_assert(TEST ${expected_int} EQUAL ${actual_int}
132 set(expected cmake-missing-NOTFOUND)
133 yaml_get(actual NAME yaml-test KEY cmake missing test key)
135 test_assert(TEST ${expected} STREQUAL ${actual}
136 COMMENT "Expected -NOTFOUND, but something was found."
141 set(expected cmake-missing-NOTFOUND)
142 yaml_length(actual NAME yaml-test KEY cmake missing test array list)
144 test_assert(TEST ${expected} STREQUAL ${actual}
145 COMMENT "Expected -NOTFOUND, but something was found."
150 set(expected -1)
151 yaml_length(actual NAME yaml-test KEY cmake test key-int)
153 test_assert(TEST ${expected} STREQUAL ${actual}
154 COMMENT "Not array expected, so length should be -1."
159 set(expected cmake-test-map-list-3-NOTFOUND)
160 yaml_get(actual NAME yaml-test KEY cmake test map-list 3 map-entry-name)
162 test_assert(TEST ${expected} STREQUAL ${actual}
163 COMMENT "Expected -NOTFOUND, but something was found."
168 yaml_save(NAME yaml-test FILE ${CMAKE_BINARY_DIR}/${CMAKE_CURRENT_FUNCTION}_test_save.yaml)
170 # Read-back the yaml and verify the value.
175 yaml_get(actual NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test key-string)
177 test_assert(TEST ${expected} STREQUAL ${actual}
182 yaml_get(actual NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test key-int)
184 test_assert(TEST ${expected} EQUAL ${actual}
191 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
195 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
196 KEY cmake test set key-string VALUE ${new_value}
199 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
201 # Read-back the yaml and verify the value.
206 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-string)
208 test_assert(TEST ${new_value} STREQUAL ${readback}
215 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
219 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
220 KEY cmake test set key-list-string LIST ${new_value}
223 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
225 # Read-back the yaml and verify the value.
230 yaml_length(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-string)
232 test_assert(TEST 5 EQUAL ${readback}
236 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-string)
239 test_assert(TEST "${e}" STREQUAL "${a}"
247 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
251 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
252 KEY cmake test set key-list-string
258 list(SUBLIST new_value 1 -1 others)
260 # re-initialize the list with the first correct value
261 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
262 KEY cmake test set key-list-string
268 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
269 KEY cmake test set key-list-string
274 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
276 # Read-back the yaml and verify the value.
281 yaml_length(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-string)
283 test_assert(TEST 5 EQUAL ${readback}
287 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-string)
290 test_assert(TEST "${e}" STREQUAL "${a}"
298 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
302 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
303 KEY cmake test set key-int VALUE ${new_value}
306 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
308 # Read-back the yaml and verify the value.
313 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-int)
315 test_assert(TEST ${new_value} STREQUAL ${readback}
322 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
326 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
327 KEY cmake test set key-list-int LIST ${new_value}
330 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
332 # Read-back the yaml and verify the value.
337 yaml_length(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-int)
339 test_assert(TEST 5 EQUAL ${readback}
343 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-int)
346 test_assert(TEST "${e}" STREQUAL "${a}"
354 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
363 yaml_set(actual NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
364 KEY cmake test set map-list LIST
365 MAP "map-entry-name: ${new_entry_name_0}, map-entry-int: ${new_entry_int_0}"
366 MAP "map-entry-name: ${new_entry_name_1}, map-entry-int: ${new_entry_int_1}"
367 MAP "map-entry-name: ${new_entry_name_2}, map-entry-int: ${new_entry_int_2}"
370 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
372 # Read-back the yaml and verify the values.
377 yaml_length(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list)
379 test_assert(TEST 3 EQUAL ${readback}
384 …ck_name NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list ${index} map-entry-nam…
385 …ck_int NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list ${index} map-entry-int)
387 test_assert(TEST "${readback_name}" STREQUAL "${new_entry_name_${index}}"
390 test_assert(TEST "${readback_int}" EQUAL "${new_entry_int_${index}}"
398 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
407 yaml_set(actual NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
408 KEY cmake test set map-list LIST
409 MAP "map-entry-name: ${new_entry_name_0}, map-entry-path: ${new_entry_path_0}"
410 MAP "map-entry-name: ${new_entry_name_1}, map-entry-path: ${new_entry_path_1}"
411 MAP "map-entry-name: ${new_entry_name_2}, map-entry-path: ${new_entry_path_2}"
414 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
416 # Read-back the yaml and verify the values.
421 yaml_length(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list)
423 test_assert(TEST 3 EQUAL ${readback}
428 …ck_name NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list ${index} map-entry-nam…
429 …k_path NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list ${index} map-entry-pat…
431 test_assert(TEST "${readback_name}" STREQUAL "${new_entry_name_${index}}"
434 test_assert(TEST "${readback_path}" STREQUAL "${new_entry_path_${index}}"
442 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
451 yaml_set(actual NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
452 KEY cmake test set map-list LIST
453 MAP "map-entry-name: ${new_entry_name_0}, map-entry-str: ${new_entry_str_0}"
454 MAP "map-entry-name: ${new_entry_name_1}, map-entry-str: ${new_entry_str_1}"
455 MAP "map-entry-name: ${new_entry_name_2}, map-entry-str: ${new_entry_str_2}"
458 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
460 # Read-back the yaml and verify the values.
465 yaml_length(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list)
467 test_assert(TEST 3 EQUAL ${readback}
472 …ck_name NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list ${index} map-entry-nam…
473 …ck_str NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set map-list ${index} map-entry-str)
475 test_assert(TEST "${readback_name}" STREQUAL "${new_entry_name_${index}}"
478 test_assert(TEST "'${readback_str}'" STREQUAL "${new_entry_str_${index}}"
485 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
489 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
490 KEY cmake test set key-int VALUE ${new_value}
493 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
495 # Read-back the yaml and verify the value.
500 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-int)
513 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
517 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
518 KEY cmake test set key-list-int LIST ${new_value}
521 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
523 # Read-back the yaml and verify the value.
528 yaml_length(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-int)
530 test_assert(TEST 0 EQUAL ${readback}
534 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-int)
537 test_assert(TEST "${e}" STREQUAL "${a}"
546 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
550 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
551 KEY cmake test set key-string
557 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
558 KEY cmake test set key-string-genex
562 # create the list by appending in several steps to test conversion
564 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
565 KEY cmake test set key-list-string-genex
569 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
570 KEY cmake test set key-list-string-genex
573 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
574 KEY cmake test set key-list-string-genex
578 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
580 # Read-back the yaml immediately and verify the genex values are NOT present
586 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-string)
589 test_assert(TEST ${expected} STREQUAL ${readback}
593 …yaml_length(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-string-ge…
594 set(expected cmake-test-set-key-list-string-genex-NOTFOUND)
596 test_assert(TEST ${expected} STREQUAL ${readback}
597 COMMENT "Expected -NOTFOUND, but something was found."
600 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-string-genex)
601 set(expected cmake-test-set-key-string-genex-NOTFOUND)
603 test_assert(TEST ${expected} STREQUAL ${readback}
604 COMMENT "Expected -NOTFOUND, but something was found."
611 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
612 KEY cmake test set key-string
616 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
625 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-string)
628 test_assert(TEST ${expected} STREQUAL ${readback}
633 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-string-genex)
635 test_assert(TEST ${expected} STREQUAL ${readback}
642 …yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-string-genex)
643 …yaml_length(act_len NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-list-string-gen…
645 test_assert(TEST ${exp_len} EQUAL ${act_len}
650 test_assert(TEST "${e}" STREQUAL "${a}"
658 NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
662 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
663 KEY cmake test set key-int VALUE ${new_value}
666 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
668 # Read-back the yaml and verify the value.
673 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-int)
675 test_assert(TEST ${new_value} STREQUAL ${readback}
680 yaml_remove(NAME ${CMAKE_CURRENT_FUNCTION}_readback KEY cmake test set key-int)
683 # Read-back again and verify the value has been removed.
688 yaml_get(readback NAME ${CMAKE_CURRENT_FUNCTION}_readback_removed KEY cmake test set key-int)
690 set(expected cmake-test-set-key-int-NOTFOUND)
692 test_assert(TEST ${expected} STREQUAL ${readback}
693 COMMENT "Expected -NOTFOUND, but something was found."
698 yaml_create(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
701 yaml_set(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create
702 KEY cmake test set key-int VALUE ${new_value}
706 yaml_save(NAME ${CMAKE_CURRENT_FUNCTION}_yaml-create)
709 test_assert(TEST 1 EQUAL ${errors}
715 yaml_load(FILE ${CMAKE_CURRENT_LIST_DIR}/test.yaml NAME yaml-test)
746 # at project generation time. The script mode re-run is delayed until after
753 # Spawn a new CMake instance to re-run the whole test suite in script mode
756 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_LIST_FILE}