Skip to content

Commit ef13ee9

Browse files
authored
Apply some basic formatting rules to test files (#20688)
I mostly did with with some grepping and replacing, and stopped when I got board. We probably should just auto-format the whole thing but I tried that was was overwhelmed by the scale the changes it made.
1 parent c017fc2 commit ef13ee9

File tree

110 files changed

+950
-1156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+950
-1156
lines changed

test/alloc_3gb.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
#include <stdint.h>
44
#include <assert.h>
55

6-
int main()
7-
{
8-
uint8_t *ptr1 = (uint8_t *)malloc(1024*1024);
9-
assert(ptr1);
10-
uint8_t *ptr2 = (uint8_t *)malloc(3u*1024*1024*1024);
11-
assert(ptr2);
12-
uint8_t *ptr3 = (uint8_t *)malloc(1024*1024);
13-
assert(ptr3);
14-
free(ptr1);
15-
free(ptr3);
16-
free(ptr2);
17-
printf("OK\n");
18-
return 0;
6+
int main() {
7+
uint8_t *ptr1 = (uint8_t *)malloc(1024*1024);
8+
assert(ptr1);
9+
uint8_t *ptr2 = (uint8_t *)malloc(3u*1024*1024*1024);
10+
assert(ptr2);
11+
uint8_t *ptr3 = (uint8_t *)malloc(1024*1024);
12+
assert(ptr3);
13+
free(ptr1);
14+
free(ptr3);
15+
free(ptr2);
16+
printf("OK\n");
17+
return 0;
1918
}

test/browser/test_sdl2_canvas_blank.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <stdio.h>
99
#include <SDL2/SDL.h>
1010

11-
1211
int main() {
1312
SDL_Init(SDL_INIT_VIDEO);
1413
SDL_Window *window;
@@ -25,4 +24,3 @@ int main() {
2524

2625
return 0;
2726
}
28-

test/browser/test_sdl2_canvas_palette.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@ int main() {
7373

7474
return 0;
7575
}
76-

test/browser/test_sdl2_canvas_palette_2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,3 @@ int main(int argc, char** argv) {
9090

9191
return 0;
9292
}
93-

test/browser/test_sdl2_canvas_proxy.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,3 @@ int main(int argc, char **argv) {
5050
EM_ASM(window.close());
5151
return 0;
5252
}
53-

test/browser/webgl_array_of_structs_uniform.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#include <GLES2/gl2.h>
1414
#include <GLES3/gl3.h>
1515

16-
GLuint compile_shader(GLenum shaderType, const char *src)
17-
{
16+
GLuint compile_shader(GLenum shaderType, const char *src) {
1817
GLuint shader = glCreateShader(shaderType);
1918
glShaderSource(shader, 1, &src, NULL);
2019
glCompileShader(shader);
@@ -32,22 +31,20 @@ GLuint compile_shader(GLenum shaderType, const char *src)
3231
return 0;
3332
}
3433

35-
return shader;
34+
return shader;
3635
}
3736

38-
GLuint create_program(GLuint vertexShader, GLuint fragmentShader)
39-
{
40-
GLuint program = glCreateProgram();
41-
glAttachShader(program, vertexShader);
42-
glAttachShader(program, fragmentShader);
43-
glBindAttribLocation(program, 0, "apos");
44-
glBindAttribLocation(program, 1, "acolor");
45-
glLinkProgram(program);
46-
return program;
37+
GLuint create_program(GLuint vertexShader, GLuint fragmentShader) {
38+
GLuint program = glCreateProgram();
39+
glAttachShader(program, vertexShader);
40+
glAttachShader(program, fragmentShader);
41+
glBindAttribLocation(program, 0, "apos");
42+
glBindAttribLocation(program, 1, "acolor");
43+
glLinkProgram(program);
44+
return program;
4745
}
4846

49-
int main()
50-
{
47+
int main() {
5148
EmscriptenWebGLContextAttributes attr;
5249
emscripten_webgl_init_context_attributes(&attr);
5350
attr.majorVersion = 2;
@@ -80,8 +77,7 @@ int main()
8077
GLuint program = create_program(vs, fs);
8178
glUseProgram(program);
8279

83-
struct P
84-
{
80+
struct P {
8581
float x, y;
8682
int idx;
8783
};

test/browser/webgl_color_buffer_readpixels.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context;
1818

19-
int main()
20-
{
19+
int main() {
2120
EmscriptenWebGLContextAttributes attrs;
2221
emscripten_webgl_init_context_attributes(&attrs);
2322
attrs.enableExtensionsByDefault = true;
@@ -58,8 +57,7 @@ int main()
5857
printf("GL_IMPLEMENTATION_COLOR_READ_FORMAT for FBO with float renderbuffer: 0x%x\n", format);
5958

6059
// Try glReadPixels() in that format.
61-
if (format == GL_RGBA && type == GL_UNSIGNED_BYTE)
62-
{
60+
if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
6361
printf("Oops, WebGL implementation returns an implementation defined color type(==GL_UNSIGNED_BYTE) & format(==GL_RGBA) that should "
6462
"not be possible to be used to sample WebGL floating point color renderbuffer according to WEBGL_color_buffer_float.\n");
6563
}

test/browser/webgl_create_context.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,21 @@
2020
#include <emscripten/html5.h>
2121

2222
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
23-
std::stringstream ss(s);
24-
std::string item;
25-
while (std::getline(ss, item, delim)) {
26-
elems.push_back(item);
27-
}
28-
return elems;
23+
std::stringstream ss(s);
24+
std::string item;
25+
while (std::getline(ss, item, delim)) {
26+
elems.push_back(item);
27+
}
28+
return elems;
2929
}
3030

3131
std::vector<std::string> split(const std::string &s, char delim) {
32-
std::vector<std::string> elems;
33-
split(s, delim, elems);
34-
return elems;
32+
std::vector<std::string> elems;
33+
split(s, delim, elems);
34+
return elems;
3535
}
3636

37-
GLint GetInt(GLenum param)
38-
{
37+
GLint GetInt(GLenum param) {
3938
GLint value;
4039
glGetIntegerv(param, &value);
4140
return value;
@@ -47,8 +46,7 @@ void final(void*) {
4746

4847
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context;
4948

50-
void loop()
51-
{
49+
void loop() {
5250
EMSCRIPTEN_RESULT res;
5351
if (!context) {
5452
// new rendering frame started without a context
@@ -76,8 +74,7 @@ void loop()
7674
}
7775
}
7876

79-
int main()
80-
{
77+
int main() {
8178
bool first = true;
8279
EmscriptenWebGLContextAttributes attrs;
8380
int depth = 0;
@@ -146,7 +143,7 @@ int main()
146143
printf("RGBA: %d%d%d%d, Depth: %d, Stencil: %d, Samples: %d\n",
147144
GetInt(GL_RED_BITS), GetInt(GL_GREEN_BITS), GetInt(GL_BLUE_BITS), GetInt(GL_ALPHA_BITS),
148145
numDepthBits, numStencilBits, numSamples);
149-
146+
150147
if (!depth && stencil && numDepthBits && numStencilBits && EM_ASM_INT(navigator.userAgent.toLowerCase().indexOf('firefox')) > -1)
151148
{
152149
numDepthBits = 0;

test/browser/webgl_create_context2.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include <emscripten/emscripten.h>
1111
#include <emscripten/html5.h>
1212

13-
int main()
14-
{
13+
int main() {
1514
EmscriptenWebGLContextAttributes attrs;
1615
emscripten_webgl_init_context_attributes(&attrs);
1716
// Test that creating a context with #canvas target when -sDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0

test/browser/webgl_destroy_context.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,28 @@
1212
#include <emscripten.h>
1313
#include <emscripten/html5.h>
1414

15-
void report_result(int result)
16-
{
15+
void report_result(int result) {
1716
printf("Test finished with result %d\n", result);
1817
emscripten_force_exit(result);
1918
}
2019

21-
void finish(void*)
22-
{
20+
void finish(void*) {
2321
report_result(0);
2422
}
2523

26-
EM_BOOL context_lost(int eventType, const void *reserved, void *userData)
27-
{
24+
EM_BOOL context_lost(int eventType, const void *reserved, void *userData) {
2825
printf("C code received a signal for WebGL context lost! This should not happen!\n");
2926
report_result(1);
3027
return 0;
3128
}
3229

33-
EM_BOOL context_restored(int eventType, const void *reserved, void *userData)
34-
{
30+
EM_BOOL context_restored(int eventType, const void *reserved, void *userData) {
3531
printf("C code received a signal for WebGL context restored! This should not happen!\n");
3632
report_result(1);
3733
return 0;
3834
}
3935

40-
int main()
41-
{
36+
int main() {
4237
EmscriptenWebGLContextAttributes attrs;
4338
emscripten_webgl_init_context_attributes(&attrs);
4439
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context("#canvas", &attrs);

0 commit comments

Comments
 (0)