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

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

        mycard = fc_solve_card_parse_str([% card_string %]);
        /* TEST */
        [%- SET num_tests = num_tests + 1 %]
        assert_int_equal (fcs_card_suit(mycard), [% suit.idx %]);
            // "Parsing the suit of card " [% card_string %]);
        /* TEST */
        [%- SET num_tests = num_tests + 1 %]
        assert_int_equal (fcs_card_rank(mycard), [% rank.idx %]);
            // "Parsing the rank of card " [% card_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);
}
