summaryrefslogtreecommitdiff
path: root/src/tests/ui_elements.c
blob: a13492d43f34ffad15af4f017ec2fc30cc30556d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "../ui_elements/UI.h"
#include "test.h"
#include <stddef.h>
#include <string.h>
#include <stdio.h>

char *timerPrintDisplay() {
    char buf[16];

    size_t time = 0;
    PrintTime(buf, time);
    if (strcmp(buf, "00:00")) return reportError("The 00:00 test failed: got: '%s'", buf);

    time = 3;
    PrintTime(buf, time);
    if (strcmp(buf, "00:03")) return reportError("The 00:03 test failed: got: '%s'", buf);

    time = 30;
    PrintTime(buf, time);
    if (strcmp(buf, "00:30")) return reportError("The 00:30 test failed: got: '%s'", buf);

    time = 60;
    PrintTime(buf, time);
    if (strcmp(buf, "01:00")) return reportError("The 01:00 test failed: got: '%s'", buf);

    time = 63;
    PrintTime(buf, time);
    if (strcmp(buf, "01:03")) return reportError("The 01:03 test failed: got: '%s'", buf);

    time = 60 * 100;
    PrintTime(buf, time);
    if (strcmp(buf, "100:00")) return reportError("The 100:00 test failed: got: '%s'", buf);

    return NULL;
}