#define DEFAULT_CLOCK_TIME 0
#define DEFAULT_CLOCK_VALUE 0
-#define NR_TESTS 618
+#define NR_TESTS 604
static int64_t current_time = 42;
ok(uint_12_type, "Create an unsigned integer type");
- bt_ctf_field_type_integer_set_signed(int_64_type, 1);
+ ok(!bt_ctf_field_type_integer_set_signed(int_64_type, 1),
+ "Set signed 64 bit integer signedness to true");
ok(int_64_type, "Create a signed integer type");
enum_type = bt_ctf_field_type_enumeration_create(int_64_type);
int_16_type = bt_ctf_field_type_integer_create(16);
assert(int_16_type);
- bt_ctf_field_type_integer_set_signed(int_16_type, 1);
+ ok(!bt_ctf_field_type_integer_set_signed(int_16_type, 1),
+ "Set signedness of 16 bit integer to true");
ok(bt_ctf_field_type_integer_get_signed(int_16_type) == 1,
"bt_ctf_field_type_integer_get_signed returns a correct value for signed types");
uint_8_type = bt_ctf_field_type_integer_create(8);
ok(!bt_ctf_stream_append_event(writer_stream, event),
"bt_ctf_stream_append_event() succeeds with a writer stream");
- /*
- * Verify that it's possible to get and set the value of a
- * writer mode clock.
- */
- ok (!bt_ctf_clock_set_value(writer_clock, 1000),
- "bt_ctf_clock_set_value() succeeds with a writer mode clock");
- ok (bt_ctf_clock_get_value(writer_clock) == 1000,
- "bt_ctf_clock_get_value() succeeds with a writer mode clock");
-
- /*
- * Verify that it's impossible to get and set the value of a
- * non-writer mode clock.
- */
- ok (bt_ctf_clock_set_value(non_writer_clock, 1000),
- "bt_ctf_clock_set_value() fails with a non-writer mode clock");
- ok (bt_ctf_clock_get_value(non_writer_clock) == -1ULL,
- "bt_ctf_clock_get_value() fails with a non-writer mode clock");
-
/*
* It should be possible to create a packet from a non-writer
* stream, but not from a writer stream.
assert(!ret);
ret = bt_ctf_clock_set_frequency(clock, 1000000000);
assert(!ret);
- ok(bt_ctf_clock_ns_from_value(clock, 4321) == 1234000005321ULL,
- "bt_ctf_clock_ns_from_value() returns the correct value with a 1 GHz frequency");
ret = bt_ctf_clock_set_frequency(clock, 1534);
assert(!ret);
- ok(bt_ctf_clock_ns_from_value(clock, 4321) ==
- (uint64_t) 1237468709256.845,
- "bt_ctf_clock_ns_from_value() returns the correct value with a non-1 GHz frequency");
BT_PUT(clock);
}
const int64_t offset_s = 1351530929945824323;
const int64_t offset = 1234567;
int64_t get_offset_s,
- get_offset,
- get_time;
+ get_offset;
const uint64_t precision = 10;
const int is_absolute = 0xFF;
char *metadata_string;
/* Define a clock and add it to the trace */
ok(bt_ctf_clock_create("signed") == NULL,
"Illegal clock name rejected");
- ok(bt_ctf_clock_create(NULL) == NULL, "NULL clock name rejected");
clock = bt_ctf_clock_create(clock_name);
ok(clock, "Clock created sucessfully");
returned_clock_name = bt_ctf_clock_get_name(clock);
ok(bt_ctf_clock_get_is_absolute(clock) == !!is_absolute,
"bt_ctf_clock_get_precision returns the correct is_absolute attribute once it is set");
- ok(bt_ctf_clock_get_time(clock, &get_time) == 0,
- "bt_ctf_clock_get_time succeeds");
- ok(get_time == DEFAULT_CLOCK_TIME,
- "bt_ctf_clock_get_time returns the correct default time");
- ok(bt_ctf_clock_get_value(clock) == DEFAULT_CLOCK_VALUE,
- "bt_ctf_clock_get_value returns the correct default value");
- ok(bt_ctf_clock_set_value(clock, current_time) == 0,
- "Set clock value");
- ok(bt_ctf_clock_get_value(clock) == current_time,
- "bt_ctf_clock_get_value returns the correct value once it is set");
ok(bt_ctf_clock_set_time(clock, current_time) == 0,
"Set clock time");
- ok(bt_ctf_clock_get_time(clock, &get_time) == 0,
- "bt_ctf_clock_get_time succeeds");
- ok(get_time >= current_time - 1 && get_time <= current_time + 1,
- "bt_ctf_clock_get_time returns the correct time once it is set");
ok(!bt_ctf_clock_get_name(NULL),
"bt_ctf_clock_get_name correctly handles NULL");
"bt_ctf_clock_get_offset correctly handles NULL output");
ok(bt_ctf_clock_get_is_absolute(NULL) < 0,
"bt_ctf_clock_get_is_absolute correctly handles NULL");
- ok(bt_ctf_clock_get_time(NULL, &get_time) < 0,
- "bt_ctf_clock_get_time correctly handles NULL clock");
- ok(bt_ctf_clock_get_time(clock, NULL) < 0,
- "bt_ctf_clock_get_time correctly handles NULL output");
ok(bt_ctf_clock_set_description(NULL, NULL) < 0,
"bt_ctf_clock_set_description correctly handles NULL clock");