16 null_create_fn(
char **argv) {
21 null_create_fn_2(
char **argv) {
26 no_formats(
void **state) {
28 assert_null(pcmk__output_formatters());
32 invalid_entries(
void **state) {
37 {
"", null_create_fn, NULL },
45 valid_entries(
void **state) {
46 GHashTable *formatters = NULL;
49 {
"fmt1", null_create_fn, NULL },
50 {
"fmt2", null_create_fn_2, NULL },
56 formatters = pcmk__output_formatters();
57 assert_int_equal(g_hash_table_size(formatters), 2);
58 assert_ptr_equal(g_hash_table_lookup(formatters,
"fmt1"), null_create_fn);
59 assert_ptr_equal(g_hash_table_lookup(formatters,
"fmt2"), null_create_fn_2);
65 duplicate_keys(
void **state) {
66 GHashTable *formatters = NULL;
69 {
"fmt1", null_create_fn, NULL },
70 {
"fmt1", null_create_fn_2, NULL },
76 formatters = pcmk__output_formatters();
77 assert_int_equal(g_hash_table_size(formatters), 1);
78 assert_ptr_equal(g_hash_table_lookup(formatters,
"fmt1"), null_create_fn_2);
84 duplicate_values(
void **state) {
85 GHashTable *formatters = NULL;
88 {
"fmt1", null_create_fn, NULL },
89 {
"fmt2", null_create_fn, NULL },
95 formatters = pcmk__output_formatters();
96 assert_int_equal(g_hash_table_size(formatters), 2);
97 assert_ptr_equal(g_hash_table_lookup(formatters,
"fmt1"), null_create_fn);
98 assert_ptr_equal(g_hash_table_lookup(formatters,
"fmt2"), null_create_fn);
104 cmocka_unit_test(no_formats),
105 cmocka_unit_test(invalid_entries),
106 cmocka_unit_test(valid_entries),
107 cmocka_unit_test(duplicate_keys),
108 cmocka_unit_test(duplicate_values))
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
Formatted output for pacemaker tools.
void pcmk__register_formats(GOptionGroup *group, const pcmk__supported_format_t *table)
#define pcmk__assert_asserts(stmt)
void pcmk__unregister_formats(void)
This structure contains everything that makes up a single output formatter.