project_files/hwc/rtl/tests/check_system.c
author koda
Tue, 13 Nov 2012 23:56:50 +0100
branchwebgl
changeset 8050 c82b68016c68
parent 7983 02f36c3e7f6c
child 10015 4feced261c68
permissions -rw-r--r--
link main on osx
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7983
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     1
#include <check.h>
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     2
#include <stdlib.h>
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     3
#include <stdio.h>
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     4
#include "check_check.h"
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     5
#include "../src/system.h"
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     6
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     7
void check_string(string255 str)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     8
{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     9
	fail_unless(strlen(str.str) == str.len, "String internal inconsistency error");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    10
}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    11
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    12
static string255 make_string(const char* str)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    13
{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    14
	string255 s;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    15
	s.len = strlen(str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    16
	memcpy(s.str, str, s.len + 1);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    17
	return s;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    18
}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    19
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    20
START_TEST (test_copy)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    21
	{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    22
		string255 s = STRINIT("1234567");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    23
		string255 t;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    24
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    25
		t = fpcrtl_copy(s, 1, 1);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    26
		fail_if(strcmp(t.str, "1"), "Test copy fail 1");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    27
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    28
		t = fpcrtl_copy(s, 7, 1);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    29
		fail_if(strcmp(t.str, "7"), "Test copy fail 2");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    30
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    31
		t = fpcrtl_copy(s, 8, 1);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    32
		fail_if(t.len != 0, "Test copy fail 3");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    33
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    34
		t = fpcrtl_copy(s, 8, 100);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    35
		fail_if(t.len != 0, "Test copy fail 4");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    36
		check_string(t);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    37
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    38
		t = fpcrtl_copy(s, 0, 100);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    39
		fail_if(strcmp(t.str, "1234567"), "Test copy fail 5");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    40
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    41
		t = fpcrtl_copy(s, 0, 5);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    42
		fail_if(strcmp(t.str, "12345"), "Test copy fail 6");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    43
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    44
		t = fpcrtl_copy(s, 4, 100);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    45
		fail_if(strcmp(t.str, "4567"), "Test copy fail 7");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    46
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    47
		t = fpcrtl_copy(s, 4, 2);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    48
		fail_if(strcmp(t.str, "45"), "Test copy fail 8");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    49
	}END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    50
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    51
START_TEST (test_delete)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    52
	{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    53
		string255 s = STRINIT("1234567");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    54
		string255 s2 = STRINIT("1234567");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    55
		string255 s3 = STRINIT("1234567");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    56
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    57
		fpcrtl_delete(s, 0, 10);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    58
		fail_if(strcmp(s.str, "1234567"), "delete(\"1234567\", 0, 10)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    59
		check_string(s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    60
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    61
		fpcrtl_delete(s, 1, 1);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    62
		fail_if(strcmp(s.str, "234567"), "delete(\"1234567\", 1, 1)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    63
		check_string(s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    64
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    65
		fpcrtl_delete(s, 1, 100);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    66
		fail_if(strcmp(s.str, ""), "delete(\"234567\", 1, 100)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    67
		check_string(s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    68
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    69
		fpcrtl_delete(s2, 3, 2);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    70
		fail_if(strcmp(s2.str, "12567"), "delete(\"1234567\", 3, 2)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    71
		check_string(s2);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    72
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    73
		fpcrtl_delete(s3, 3, 100);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    74
		fail_if(strcmp(s3.str, "12"), "delete(\"1234567\", 3, 100)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    75
		check_string(s3);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    76
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    77
	}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    78
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    79
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    80
START_TEST (test_FloatToStr)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    81
	{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    82
		double s = 1.2345;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    83
		string255 t = fpcrtl_floatToStr(s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    84
		printf("-----Entering test floatToStr-----\n");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    85
		printf("FloatToStr(%f) = %s\n", s, t.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    86
		printf("-----Leaving test floatToStr-----\n");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    87
	}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    88
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    89
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    90
START_TEST (test_random)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    91
	{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    92
		fpcrtl_randomize();
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    93
		printf("-----Entering test random-----\n");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    94
		printf("random(5000) = %d\n", fpcrtl_random(5000));
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    95
		printf("random(1) = %d\n", fpcrtl_random(1));
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    96
		printf("random(2) = %d\n", fpcrtl_random(2));
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    97
		printf("-----Leaving test random-----\n");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    98
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    99
	}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   100
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   101
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   102
START_TEST (test_posS)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   103
	{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   104
		string255 substr1 = STRINIT("123");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   105
		string255 str1 = STRINIT("12345");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   106
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   107
		string255 substr2 = STRINIT("45");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   108
		string255 str2 = STRINIT("12345");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   109
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   110
		string255 substr3 = STRINIT("");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   111
		string255 str3 = STRINIT("12345");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   112
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   113
		string255 substr4 = STRINIT("123");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   114
		string255 str4 = STRINIT("");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   115
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   116
		string255 substr5 = STRINIT("123");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   117
		string255 str5 = STRINIT("456");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   118
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   119
		fail_unless(fpcrtl_posS(substr1, str1) == 1, "pos(123, 12345)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   120
		fail_unless(fpcrtl_posS(substr2, str2) == 4, "pos(45, 12345)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   121
		fail_unless(fpcrtl_posS(substr3, str3) == 0, "pos(, 12345)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   122
		fail_unless(fpcrtl_posS(substr4, str4) == 0, "pos(123, )");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   123
		fail_unless(fpcrtl_posS(substr5, str5) == 0, "pos(123, 456)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   124
	}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   125
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   126
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   127
START_TEST (test_trunc)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   128
	{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   129
		  fail_unless(fpcrtl_trunc(123.456) == 123, "trunc(123.456)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   130
		  fail_unless(fpcrtl_trunc(-123.456) == -123, "trunc(-123.456)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   131
		  fail_unless(fpcrtl_trunc(12.3456) == 12, "trunc(12.3456)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   132
		  fail_unless(fpcrtl_trunc(-12.3456) == -12, "trunc(-12.3456)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   133
	}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   134
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   135
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   136
START_TEST (test_odd)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   137
{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   138
	fail_unless(fpcrtl_odd(123) != 0, "odd(123)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   139
	fail_unless(fpcrtl_odd(124) == 0, "odd(124)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   140
	fail_unless(fpcrtl_odd(0) == 0, "odd(0)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   141
	fail_unless(fpcrtl_odd(-1) != 0, "odd(-1)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   142
	fail_unless(fpcrtl_odd(-2) == 0, "odd(-2)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   143
}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   144
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   145
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   146
START_TEST (test_sqr)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   147
{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   148
	fail_unless(fpcrtl_sqr(0) == 0, "sqr(0)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   149
	fail_unless(fpcrtl_sqr(5) == 25, "sqr(5)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   150
	fail_unless(fpcrtl_sqr(-5) == 25, "sqr(-5)");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   151
}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   152
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   153
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   154
START_TEST (test_lowercase)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   155
{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   156
	string255 s1 = STRINIT("");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   157
	string255 s2 = STRINIT("a");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   158
	string255 s3 = STRINIT("abc");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   159
	string255 t;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   160
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   161
	t = fpcrtl_lowerCase(make_string(""));
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   162
	fail_if(strcmp(t.str, s1.str), "lowerCase(\"\")");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   163
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   164
	t = fpcrtl_lowerCase(make_string("a"));
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   165
	fail_if(strcmp(t.str, s2.str), "lowerCase(\"a\")");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   166
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   167
	t = fpcrtl_lowerCase(make_string("A"));
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   168
	fail_if(strcmp(t.str, s2.str), "lowerCase(\"A\")");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   169
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   170
	t = fpcrtl_lowerCase(make_string("AbC"));
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   171
	fail_if(strcmp(t.str, s3.str), "lowerCase(\"AbC\")");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   172
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   173
	t = fpcrtl_lowerCase(make_string("abc"));
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   174
	fail_if(strcmp(t.str, s3.str), "lowerCase(\"abc\")");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   175
}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   176
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   177
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   178
START_TEST (test_str)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   179
{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   180
	int8_t a1 = -8;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   181
	uint8_t a2 = 8;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   182
	int16_t a3 = -13;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   183
	uint16_t a4 = 13;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   184
	int32_t a5 = -19;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   185
	uint32_t a6 = 22;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   186
	int64_t a7 = -199999999999999;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   187
	uint64_t a8 = 200000000000000;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   188
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   189
	float a9 = 12345.6789;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   190
	double a10 = -9876.54321;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   191
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   192
	string255 s;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   193
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   194
	printf("-----Entering test str-----\n");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   195
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   196
	fpcrtl_str(a1, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   197
	printf("%d == %s\n", a1, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   198
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   199
	fpcrtl_str(a2, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   200
	printf("%u == %s\n", a2, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   201
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   202
	fpcrtl_str(a3, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   203
	printf("%d == %s\n", a3, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   204
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   205
	fpcrtl_str(a4, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   206
	printf("%u == %s\n", a4, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   207
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   208
	fpcrtl_str(a5, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   209
	printf("%d == %s\n", a5, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   210
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   211
	fpcrtl_str(a6, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   212
	printf("%u == %s\n", a6, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   213
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   214
	fpcrtl_str(a7, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   215
	printf("%lld == %s\n", a7, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   216
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   217
	fpcrtl_str(a8, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   218
	printf("%llu == %s\n", a8, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   219
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   220
	fpcrtl_str(a9, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   221
	printf("%f == %s\n", a9, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   222
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   223
	fpcrtl_str(a10, s);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   224
	printf("%f == %s\n", a10, s.str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   225
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   226
	printf("-----Leaving test str------\n");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   227
}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   228
END_TEST
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   229
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   230
Suite* system_suite(void)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   231
{
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   232
	Suite *s = suite_create("system");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   233
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   234
	TCase *tc_core = tcase_create("Core");
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   235
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   236
	tcase_add_test(tc_core, test_copy);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   237
	tcase_add_test(tc_core, test_FloatToStr);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   238
	tcase_add_test(tc_core, test_random);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   239
	tcase_add_test(tc_core, test_posS);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   240
	tcase_add_test(tc_core, test_trunc);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   241
	tcase_add_test(tc_core, test_delete);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   242
	tcase_add_test(tc_core, test_odd);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   243
	tcase_add_test(tc_core, test_sqr);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   244
	tcase_add_test(tc_core, test_lowercase);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   245
	tcase_add_test(tc_core, test_str);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   246
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   247
	suite_add_tcase(s, tc_core);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   248
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   249
	return s;
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   250
}
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
   251