tests: add bt_field_string_clear test
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 24 May 2023 16:43:49 +0000 (12:43 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 31 May 2023 19:47:48 +0000 (15:47 -0400)
commit08b4db4178d307460dd9c9cbd80cb060ef2e5f13
treecf92c7ed68abab6eb3062e509e13feea5911ea33
parent366250bb5c11b94bbe32f7e1b1f1e85c4687891c
tests: add bt_field_string_clear test

Add a test for bt_field_string_clear, exercising the fix done in commit
0022a87819b0 ("Fix: clear_string_field(): set first character to 0").
The test sets the field to a non-empty value, clears it with
bt_field_string_clear, and verifies that the value returned by
bt_field_string_get_value is an empty string, and that the length
returned by bt_field_string_get_length is 0.

When reverting 0022a87819b0, the test gives:

    1..2
    not ok 1 - string field is empty
    #     Failed test (/home/smarchi/src/babeltrace/tests/lib/test_fields.cpp:operator()() at line 36)
    ok 2 - string field length is 0
    # Looks like you failed 1 test of 2.

Change-Id: I46800a93a7290fe72618081efdc5cdcd944c8567
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10068
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
tests/Makefile.am
tests/lib/Makefile.am
tests/lib/test_fields [new file with mode: 0755]
tests/lib/test_fields_bin.cpp [new file with mode: 0644]
tests/lib/utils/run-in.cpp
This page took 0.024957 seconds and 4 git commands to generate.