+ "enum_field") == 0, "Add signed enumeration field to event");
+
+ ok(bt_ctf_field_type_enumeration_get_mapping(NULL, 0, &ret_char,
+ &ret_range_start_int64_t, &ret_range_end_int64_t) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping handles a NULL enumeration correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping(enum_type, 0, NULL,
+ &ret_range_start_int64_t, &ret_range_end_int64_t) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping handles a NULL string correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping(enum_type, 0, &ret_char,
+ NULL, &ret_range_end_int64_t) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping handles a NULL start correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping(enum_type, 0, &ret_char,
+ &ret_range_start_int64_t, NULL) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping handles a NULL end correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping(enum_type, 5, &ret_char,
+ &ret_range_start_int64_t, &ret_range_end_int64_t) == 0,
+ "bt_ctf_field_type_enumeration_get_mapping returns a value");
+ ok(!strcmp(ret_char, mapping_name_test),
+ "bt_ctf_field_type_enumeration_get_mapping returns a correct mapping name");
+ ok(ret_range_start_int64_t == 42,
+ "bt_ctf_field_type_enumeration_get_mapping returns a correct mapping start");
+ ok(ret_range_end_int64_t == 42,
+ "bt_ctf_field_type_enumeration_get_mapping returns a correct mapping end");
+
+ ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned,
+ "escaping; \"test\"", 0, 0) == 0,
+ "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing quotes");
+ ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned,
+ "\tanother \'escaping\'\n test\"", 1, 4) == 0,
+ "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing special characters");
+ ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned,
+ "event clock int float", 5, 22) == 0,
+ "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing reserved keywords");
+ bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test,
+ 42, 42);
+ ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test,
+ 43, 51), "bt_ctf_field_type_enumeration_add_mapping_unsigned rejects duplicate mapping names");
+ ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, "something",
+ 7, 8), "bt_ctf_field_type_enumeration_add_mapping_unsigned rejects overlapping enum entries");
+ ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test,
+ 55, 54), "bt_ctf_field_type_enumeration_add_mapping_unsigned rejects mapping where end < start");
+ ok(bt_ctf_event_class_add_field(simple_event_class, enum_type_unsigned,
+ "enum_field_unsigned") == 0, "Add unsigned enumeration field to event");
+
+ ok(bt_ctf_field_type_enumeration_get_mapping_count(NULL) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping_count handles NULL correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping_count(enum_type_unsigned) == 4,
+ "bt_ctf_field_type_enumeration_get_mapping_count returns the correct value");
+
+ ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(NULL, 0, &ret_char,
+ &ret_range_start_uint64_t, &ret_range_end_uint64_t) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping_unsigned handles a NULL enumeration correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, NULL,
+ &ret_range_start_uint64_t, &ret_range_end_uint64_t) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping_unsigned handles a NULL string correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, &ret_char,
+ NULL, &ret_range_end_uint64_t) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping_unsigned handles a NULL start correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, &ret_char,
+ &ret_range_start_uint64_t, NULL) < 0,
+ "bt_ctf_field_type_enumeration_get_mapping_unsigned handles a NULL end correctly");
+ ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 3, &ret_char,
+ &ret_range_start_uint64_t, &ret_range_end_uint64_t) == 0,
+ "bt_ctf_field_type_enumeration_get_mapping_unsigned returns a value");
+ ok(!strcmp(ret_char, mapping_name_test),
+ "bt_ctf_field_type_enumeration_get_mapping_unsigned returns a correct mapping name");
+ ok(ret_range_start_uint64_t == 42,
+ "bt_ctf_field_type_enumeration_get_mapping_unsigned returns a correct mapping start");
+ ok(ret_range_end_uint64_t == 42,
+ "bt_ctf_field_type_enumeration_get_mapping_unsigned returns a correct mapping end");