libubox/tests/cram/test_list.t
Petr Štetiar b0a5cd8a28 add cram based unit tests
For improved QA etc. For the start with initial test cases for avl,
base64, jshn and list components. Moved runqueue and blobmsg from
examples to tests.  Converted just a few first test cases from
json-script example into the new cram based unit test, more to come.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-24 13:26:58 +01:00

22 lines
987 B
Perl

check that list is producing expected results:
$ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
$ valgrind --quiet --leak-check=full test-list
test_basics: list_empty: yes
test_basics: list_add_tail: zero one two three four five six seven eight nine ten eleven twelve
test_basics: list_empty: no
test_basics: first=zero last=twelve
test_basics: 'zero' is first, yes
test_basics: 'twelve' is last, yes
test_basics: removing 'twelve' and 'zero'
test_basics: first=one last=eleven
test_basics: 'one' is first, yes
test_basics: 'eleven' is last, yes
test_basics: moving 'one' to the tail
test_basics: first=two last=one
test_basics: 'two' is first, yes
test_basics: 'one' is last, yes
test_basics: list_for_each_entry: two three four five six seven eight nine ten eleven one
test_basics: list_for_each_entry_reverse: one eleven ten nine eight seven six five four three two
test_basics: delete all entries
test_basics: list_empty: yes