/* vim:syn=tt2
*/
#include "rinutils/rin_cmocka.h"
#include "card.c"

static void main_tests(void **state GCC_UNUSED)
{
    char buffer[1024];

[% SET num_tests = 0 %]
[% FOREACH suit = suits %]
[% FOREACH rank = ranks %]
[% IF implicit_t %]
[% SET t_array = [1] %]
[% ELSE %]
[% SET t_array = [0,1] %]
[% END %]
[% FOREACH t = t_array %]
[%- SET t_key = t ? "t" : "non_t" -%]
[%- SET card_string = ('"'
            _   rank.value.${t_key}
            _   suit.value
            _   '"') -%]
    {
        fcs_card mycard = fcs_make_card([% rank.idx %], [% suit.idx %]);

        fc_solve_card_stringify(mycard, buffer
        [%- IF NOT implicit_t -%]
        , [% t %]
        [%- END -%]
        );
        /* TEST */
        [%- SET num_tests = num_tests + 1 -%]
        assert_string_equal(buffer, [% card_string %]);
        //    "fcs_make_card() - Trying to render " [% card_string %] " into a string");
    }
[% END %]
[% END %]
[% END %]
}

int main(void)
{
  // plan([% num_tests %]);
  const struct CMUnitTest tests[]={
    cmocka_unit_test(main_tests),
    };
  return cmocka_run_group_tests(tests, NULL, NULL);
}
