#include <stdio.h>
#include <stdlib.h>

#include "{{ here }}/csource/psychic.h"
#include "{{ here }}/csource/psychic_share.h"

#include "{{ testfile }}"

int pc_total_assertions = 0;
int pc_current_test_failed = 0;

char* pc_current_test_name;
FILE* pc_error_messages;

int main(int argc, char* argv[]) 
{
        pc_error_messages = fopen("{{ results_file }}", "w");
        int pc_failures = 0;

{% for test in testcases %}
        {% for _setup in setup %}
            {{ _setup }};
        {% endfor %}

        pc_current_test_name = "\"{{ testfile }}:{{ test }}\"";
        {{ test }};
        if (pc_current_test_failed) 
        {
            pc_failures++;
            printf("F");
        } else 
        {
            printf(".");
        }

        pc_current_test_failed=0;

        {% for _teardown in teardown %}
            {{ _teardown }};
        {% endfor %}
{% endfor %}

        return pc_failures;
}
