added glshim library
This commit is contained in:
10
project/jni/glshim/test/tests/util/gl_str.c
Normal file
10
project/jni/glshim/test/tests/util/gl_str.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "gl_str.h"
|
||||
|
||||
int main() {
|
||||
#define check(func, name) assert(strcmp(func(name), #name) == 0);
|
||||
check(gl_str_primitive, GL_QUADS);
|
||||
check(gl_str, GL_FLOAT);
|
||||
check(gl_bits_glPushClientAttrib, GL_CLIENT_ALL_ATTRIB_BITS);
|
||||
check(gl_bits_glPushAttrib, GL_CURRENT_BIT | GL_POINT_BIT);
|
||||
mock_return;
|
||||
}
|
||||
30
project/jni/glshim/test/tests/util/tack.c
Normal file
30
project/jni/glshim/test/tests/util/tack.c
Normal file
@@ -0,0 +1,30 @@
|
||||
int main() {
|
||||
tack_t stack = {0};
|
||||
tack_push(&stack, 1);
|
||||
assert(tack_peek(&stack) == 1);
|
||||
assert(tack_len(&stack) == 1);
|
||||
|
||||
tack_push(&stack, 2);
|
||||
tack_push(&stack, 3);
|
||||
assert(tack_get(&stack, 0) == 1);
|
||||
assert(tack_peek(&stack) == 3);
|
||||
assert(tack_pop(&stack) == 3);
|
||||
assert(tack_peek(&stack) == 2);
|
||||
|
||||
tack_clear(&stack);
|
||||
assert(tack_len(&stack) == 0);
|
||||
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
tack_push(&stack, i);
|
||||
assert(tack_peek(&stack) == i);
|
||||
}
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
assert(tack_shift(&stack) == i);
|
||||
}
|
||||
|
||||
tack_clear(&stack);
|
||||
tack_set(&stack, 1, "test");
|
||||
assert(tack_get(&stack, 0) == NULL);
|
||||
assert(strcmp(tack_get(&stack, 1), "test") == 0);
|
||||
mock_return;
|
||||
}
|
||||
Reference in New Issue
Block a user