forked from github/server
invalid tests for some architectures (char is not guaranteed to be signed or unsigned)
fix tests on ARM
This commit is contained in:
parent
0d8a196491
commit
b769be0f60
|
@ -64,16 +64,16 @@ static void test_regionid(CuTest * tc) {
|
|||
plain = test_create_terrain("plain", 0);
|
||||
r = test_create_region(0, 0, plain);
|
||||
|
||||
memset(buffer, -2, sizeof(buffer));
|
||||
memset(buffer, 0x7d, sizeof(buffer));
|
||||
len = f_regionid(r, 0, buffer, sizeof(buffer));
|
||||
CuAssertIntEquals(tc, 11, len);
|
||||
CuAssertStrEquals(tc, "plain (0,0)", buffer);
|
||||
|
||||
memset(buffer, -2, sizeof(buffer));
|
||||
memset(buffer, 0x7d, sizeof(buffer));
|
||||
len = f_regionid(r, 0, buffer, 11);
|
||||
CuAssertIntEquals(tc, 10, len);
|
||||
CuAssertStrEquals(tc, "plain (0,0", buffer);
|
||||
CuAssertIntEquals(tc, (char)-2, buffer[11]);
|
||||
CuAssertIntEquals(tc, 0x7d, buffer[11]);
|
||||
}
|
||||
|
||||
CuSuite *get_reports_suite(void)
|
||||
|
|
|
@ -6,7 +6,7 @@ static void test_strlcat(CuTest * tc)
|
|||
{
|
||||
char buffer[32];
|
||||
|
||||
memset(buffer, -2, sizeof(buffer));
|
||||
memset(buffer, 0xfe, sizeof(buffer));
|
||||
|
||||
buffer[0] = '\0';
|
||||
CuAssertIntEquals(tc, 4, strlcat(buffer, "herp", 4));
|
||||
|
@ -15,47 +15,47 @@ static void test_strlcat(CuTest * tc)
|
|||
buffer[0] = '\0';
|
||||
CuAssertIntEquals(tc, 4, strlcat(buffer, "herp", 8));
|
||||
CuAssertStrEquals(tc, "herp", buffer);
|
||||
CuAssertIntEquals(tc, (char)-2, buffer[5]);
|
||||
CuAssertIntEquals(tc, 0xfe, buffer[5]);
|
||||
|
||||
CuAssertIntEquals(tc, 8, strlcat(buffer, "derp", 8));
|
||||
CuAssertStrEquals(tc, "herpder", buffer);
|
||||
CuAssertIntEquals(tc, (char)-2, buffer[8]);
|
||||
CuAssertIntEquals(tc, 0xfe, buffer[8]);
|
||||
}
|
||||
|
||||
static void test_strlcpy(CuTest * tc)
|
||||
{
|
||||
char buffer[32];
|
||||
|
||||
memset(buffer, -2, sizeof(buffer));
|
||||
memset(buffer, 0xed, sizeof(buffer));
|
||||
|
||||
CuAssertIntEquals(tc, 4, strlcpy(buffer, "herp", 4));
|
||||
CuAssertStrEquals(tc, "her", buffer);
|
||||
|
||||
CuAssertIntEquals(tc, 4, strlcpy(buffer, "herp", 8));
|
||||
CuAssertStrEquals(tc, "herp", buffer);
|
||||
CuAssertIntEquals(tc, (char)-2, buffer[5]);
|
||||
CuAssertIntEquals(tc, 0xed, buffer[5]);
|
||||
|
||||
CuAssertIntEquals(tc, 8, strlcpy(buffer, "herpderp", 8));
|
||||
CuAssertStrEquals(tc, "herpder", buffer);
|
||||
CuAssertIntEquals(tc, (char)-2, buffer[8]);
|
||||
CuAssertIntEquals(tc, 0xed, buffer[8]);
|
||||
}
|
||||
|
||||
static void test_slprintf(CuTest * tc)
|
||||
{
|
||||
char buffer[32];
|
||||
|
||||
memset(buffer, -2, sizeof(buffer));
|
||||
memset(buffer, 0x7f, sizeof(buffer));
|
||||
|
||||
CuAssertTrue(tc, slprintf(buffer, 4, "%s", "herpderp")>3);
|
||||
CuAssertStrEquals(tc, "her", buffer);
|
||||
|
||||
CuAssertIntEquals(tc, 4, slprintf(buffer, 8, "%s", "herp"));
|
||||
CuAssertStrEquals(tc, "herp", buffer);
|
||||
CuAssertIntEquals(tc, (char)-2, buffer[5]);
|
||||
CuAssertIntEquals(tc, 0x7f, buffer[5]);
|
||||
|
||||
CuAssertIntEquals(tc, 8, slprintf(buffer, 8, "%s", "herpderp"));
|
||||
CuAssertStrEquals(tc, "herpder", buffer);
|
||||
CuAssertIntEquals(tc, (char)-2, buffer[8]);
|
||||
CuAssertIntEquals(tc, 0x7f, buffer[8]);
|
||||
}
|
||||
|
||||
CuSuite *get_bsdstring_suite(void)
|
||||
|
|
Loading…
Reference in New Issue