Add more test
This commit is contained in:
1 parent
a4753be5ae
commit
c78c75d89a
1 file changed
+36
-2
+36
-2
@@ -140,7 +140,7 @@ static void test_global(void)
|
|||||||
snapshot_data_clear(g_buff);
|
snapshot_data_clear(g_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mrsw_int(void)
|
static void test_mrsw_int1(void)
|
||||||
{
|
{
|
||||||
snapshot_mrsw_int_t idx;
|
snapshot_mrsw_int_t idx;
|
||||||
snapshot_mrsw_int_init(idx, 1);
|
snapshot_mrsw_int_init(idx, 1);
|
||||||
@@ -170,11 +170,45 @@ static void test_mrsw_int(void)
|
|||||||
snapshot_mrsw_int_clear(idx);
|
snapshot_mrsw_int_clear(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_mrsw_int2(void)
|
||||||
|
{
|
||||||
|
snapshot_mrsw_int_t idx;
|
||||||
|
snapshot_mrsw_int_init(idx, 2);
|
||||||
|
|
||||||
|
assert (snapshot_mrsw_int_get_write_idx(idx) == 1);
|
||||||
|
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 0);
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 1);
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 0);
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 1);
|
||||||
|
|
||||||
|
assert (snapshot_mrsw_int_read_start(idx) == 0);
|
||||||
|
snapshot_mrsw_int_read_end(idx, 0);
|
||||||
|
assert (snapshot_mrsw_int_read_start(idx) == 0);
|
||||||
|
snapshot_mrsw_int_read_end(idx, 0);
|
||||||
|
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 0);
|
||||||
|
|
||||||
|
assert (snapshot_mrsw_int_read_start(idx) == 1);
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 2);
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 0);
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 2);
|
||||||
|
assert (snapshot_mrsw_int_read_start(idx) == 0);
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 3);
|
||||||
|
snapshot_mrsw_int_read_end(idx, 1);
|
||||||
|
assert (snapshot_mrsw_int_read_start(idx) == 2);
|
||||||
|
assert (snapshot_mrsw_int_write(idx) == 1);
|
||||||
|
snapshot_mrsw_int_read_end(idx, 0);
|
||||||
|
|
||||||
|
snapshot_mrsw_int_clear(idx);
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
test_uint();
|
test_uint();
|
||||||
test_global();
|
test_global();
|
||||||
test_mrsw_int();
|
test_mrsw_int1();
|
||||||
|
test_mrsw_int2();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user