/* vim:syn=tt2
*/
#include <tap.h>
#include <string.h>

#include "../card.c"

static int main_tests(void)
{
    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_t 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 -%]
        ok (!strcmp(buffer, [% card_string %]),
            "fcs_make_card() - Trying to render " [% card_string %] " into a string");
    }
[% END %]
[% END %]
[% END %]

    return 0;
}

int main(void)
{
  plan_tests([% num_tests %]);
  main_tests();
  return exit_status();
}
