Skip to content

Commit d80c7c7

Browse files
authored
Fix = vs == typos in test assertions. NFC (#24194)
I first noticed a type in audioworklet_params_mixing.c from #23659 then found several other tests with the same issue. Nasty. Not sure what to do about the test_sdl_set_clip_rect assertions which don't seem to be valid (i.e. they fail with the typo fixed).
1 parent c2924cd commit d80c7c7

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

test/browser/test_sdl_set_clip_rect.c

+18-16
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,21 @@ int main() {
4242
SDL_SetClipRect(dst, &firstRect);
4343
SDL_BlitSurface(src, &rect, dst, &rect);
4444

45-
assert(rect.x = firstRect.x);
46-
assert(rect.y = firstRect.y);
47-
assert(rect.w = firstRect.w);
48-
assert(rect.h = firstRect.h);
45+
assert(rect.x == firstRect.x);
46+
assert(rect.y == firstRect.y);
47+
assert(rect.w == firstRect.w);
48+
assert(rect.h == firstRect.h);
4949

5050
/* Draw green rect on red rect */
5151
SDL_FillRect(src, &rect, SDL_MapRGB(src->format, 0, 255, 0));
5252
SDL_SetClipRect(dst, &secondRect);
5353
SDL_BlitSurface(src, &rect, dst, &rect);
5454

55-
assert(rect.x = secondRect.x);
56-
assert(rect.y = secondRect.y);
57-
assert(rect.w = firstRect.x + firstRect.w);
58-
assert(rect.h = firstRect.h + firstRect.h);
55+
assert(rect.x == secondRect.x);
56+
assert(rect.y == secondRect.y);
57+
// FIXME(https://github.com/emscripten-core/emscripten/issues/24201)
58+
//assert(rect.w == firstRect.x + firstRect.w);
59+
//assert(rect.h == firstRect.h + firstRect.h);
5960

6061
/* Same with fill rect */
6162
rect.x = 0; rect.y = 0;
@@ -64,18 +65,19 @@ int main() {
6465
SDL_SetClipRect(dst, &firstRectForFill);
6566
SDL_FillRect(dst, &rect, SDL_MapRGB(dst->format, 0, 0, 255));
6667

67-
assert(rect.x = firstRectForFill.x);
68-
assert(rect.y = firstRectForFill.y);
69-
assert(rect.w = firstRectForFill.w);
70-
assert(rect.h = firstRectForFill.h);
68+
assert(rect.x == firstRectForFill.x);
69+
assert(rect.y == firstRectForFill.y);
70+
assert(rect.w == firstRectForFill.w);
71+
assert(rect.h == firstRectForFill.h);
7172

7273
SDL_SetClipRect(dst, &secondRectForFill);
7374
SDL_FillRect(dst, &rect, SDL_MapRGBA(dst->format, 255, 0, 255, 255));
7475

75-
assert(rect.x = secondRectForFill.x);
76-
assert(rect.y = secondRectForFill.y);
77-
assert(rect.w = firstRectForFill.x + firstRectForFill.w);
78-
assert(rect.h = firstRectForFill.h + firstRectForFill.h);
76+
assert(rect.x == secondRectForFill.x);
77+
assert(rect.y == secondRectForFill.y);
78+
// FIXME(https://github.com/emscripten-core/emscripten/issues/24201)
79+
//assert(rect.w == firstRectForFill.x + firstRectForFill.w);
80+
//assert(rect.h == firstRectForFill.h + firstRectForFill.h);
7981

8082
SDL_GetClipRect(dst, &rectForTest);
8183
assert(rectForTest.x == 270);

test/core/test_dlfcn_self.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void repeatable() {
2222

2323
int* global_ptr = (int*)dlsym(self, "global");
2424
assert(global_ptr);
25-
assert(*global_ptr = 123);
25+
assert(*global_ptr == 123);
2626

2727
void (*foo_ptr)(int) = (void (*)(int))dlsym(self, "foo");
2828
assert(foo_ptr);

test/other/test_stat_fail_alongtheway.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ int main() {
1414
{
1515
struct stat st;
1616
assert(stat("path", &st) == 0);
17-
assert(st.st_mode = 0777);
17+
assert((st.st_mode & ~S_IFMT) == 0777);
1818
}
1919
{
2020
struct stat st;
@@ -25,7 +25,7 @@ int main() {
2525
{
2626
struct stat st;
2727
assert(stat("path/file", &st) == 0);
28-
assert(st.st_mode = 0666);
28+
assert((st.st_mode & ~S_IFMT) == 0644);
2929
}
3030
{
3131
struct stat st;

test/unistd/truncate.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ void setup() {
1919
FILE* f = fopen("towrite", "w");
2020
assert(f);
2121
rtn = fwrite("abcdef", 6, 1, f);
22-
assert(rtn = 6);
22+
assert(rtn == 1);
2323
fclose(f);
2424

2525
f = fopen("toread", "w");
2626
assert(f);
2727
rtn = fwrite("abcdef", 6, 1, f);
28-
assert(rtn = 6);
28+
assert(rtn == 1);
2929
fclose(f);
3030

3131
assert(chmod("toread", 0444) == 0);

test/webaudio/audioworklet_params_mixing.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ bool process(int numInputs, const AudioSampleFrame* inputs, int numOutputs, Audi
3333
// Interestingly, params varies per browser. Chrome won't have a length > 1
3434
// unless the value changes, and FF has all 128 entries even for a k-rate
3535
// parameter. The only given is that two params are incoming:
36-
assert(numParams = 2);
36+
assert(numParams == 2);
3737
assert(params[0].length == 1 || params[0].length == outSamplesPerChannel);
3838
assert(params[1].length == 1 || params[1].length == outSamplesPerChannel);
3939
// We can now do a quick mix since we know the layouts

0 commit comments

Comments
 (0)