- ok(bt_ctf_field_type_enumeration_get_mapping_index_by_name(NULL,
- "INT16_TYPE") < 0,
- "bt_ctf_field_type_enumeration_get_mapping_index_by_name handles a NULL field type correctly");
- ok(bt_ctf_field_type_enumeration_get_mapping_index_by_name(
- enum_variant_type, NULL) < 0,
- "bt_ctf_field_type_enumeration_get_mapping_index_by_name handles a NULL name correctly");
- ok(bt_ctf_field_type_enumeration_get_mapping_index_by_name(
- enum_variant_type, "INT16_TYPE") == 1,
- "bt_ctf_field_type_enumeration_get_mapping_index_by_name returns the correct index");
-
- ok(bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value(NULL, 1) < 0,
- "bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value handles a NULL field type correctly");
- ok(bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value(enum_variant_type, -42) < 0,
- "bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value handles invalid values correctly");
- ok(bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value(enum_variant_type, 5) == 2,
- "bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value returns the correct index");
+ iter = bt_ctf_field_type_enumeration_find_mappings_by_name(NULL, "INT16_TYPE");
+ ok(iter == NULL, "bt_ctf_field_type_enumeration_find_mappings_by_name handles a NULL field type correctly");
+
+ iter = bt_ctf_field_type_enumeration_find_mappings_by_name(enum_variant_type, "INT16_TYPE");
+ ok(iter != NULL, "bt_ctf_field_type_enumeration_find_mappings_by_name handles an existing mapping correctly");
+ ok(bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) == 0,
+ "bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned handles mapped values correctly");
+ BT_PUT(iter);
+
+ iter = bt_ctf_field_type_enumeration_find_mappings_by_name(enum_variant_type, NULL);
+ ok(iter == NULL, "bt_ctf_field_type_enumeration_find_mappings_by_name handles a NULL name correctly");
+
+ iter = bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(NULL, 1);
+ ok(iter == NULL, "bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value handles a NULL field type correctly");
+
+ iter = bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(enum_variant_type, -42);
+ ok(iter == NULL, "bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value handles invalid values correctly");
+ ok(bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) != 0,
+ "bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned handles invalid values correctly");
+ BT_PUT(iter);
+
+ iter = bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(enum_variant_type, 5);
+ ok(iter != NULL, "bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value handles valid values correctly");
+ ok(bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) == 0,
+ "bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned handles valid values correctly");
+ BT_PUT(iter);