MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / Verify

Function Verify

test/browser/test_sdl_gl_read.c:128–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void Verify() {
129 unsigned char *data = malloc(width*height*4 + 16);
130 int *last = (int*)(data + width*height*4 - 4);
131 int *after = (int*)(data + width*height*4);
132 *last = 0xdeadbeef;
133 *after = 0x12345678;
134 glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data);
135 assert(*last != 0xdeadbeef); // should overwrite the buffer to the end
136 assert(*after == 0x12345678); // nothing should be written afterwards!
137 // Should see some blue, and nothing else
138 int seen = 0;
139 int ok = 1;
140 for (int x = 0; x < width*height; x++) {
141 seen = seen || data[x*4+2] != 0;
142 ok = ok && (data[x*4+0] == 0);
143 ok = ok && (data[x*4+1] == 0);
144 }
145 assert(seen);
146 assert(ok);
147}
148
149int main(int argc, char *argv[])
150{

Callers 1

mainFunction · 0.70

Calls 2

mallocFunction · 0.50
assertFunction · 0.50

Tested by

no test coverage detected