Skip to content

Commit 515af00

Browse files
authored
Cleanup test_float_builtins. NFC (emscripten-core#16337)
Consistent indentation and make output more meaningful. While investigating emscripten-core#16336 I noticed it wasn't obvious what these values were in the `.out` file.
1 parent b73a298 commit 515af00

2 files changed

Lines changed: 39 additions & 39 deletions

File tree

tests/core/test_float_builtins.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,41 @@
1010

1111
// Prints the float/double/long double versions of the given function
1212
// e.g.: TEST(fmax) prints fmaxf : fmax : fmaxl
13-
#define TEST(func) \
14-
printf("%f : %f : %Lf\n", \
15-
__builtin_##func##f(f1, f2), \
16-
__builtin_##func(d1, d2), \
17-
__builtin_##func##l(l1, l2));
13+
#define TEST(func) \
14+
printf("__builtin_" #func " %f : %f : %Lf\n", \
15+
__builtin_##func##f(f1, f2), \
16+
__builtin_##func(d1, d2), \
17+
__builtin_##func##l(l1, l2));
1818

19-
#define TESTI(func) \
20-
printf("%f : %f : %Lf\n", \
21-
__builtin_##func##f(f1, i1), \
22-
__builtin_##func(d1, i1), \
23-
__builtin_##func##l(l1, i1));
19+
#define TESTI(func) \
20+
printf("__builtin_" #func " %f : %f : %Lf\n", \
21+
__builtin_##func##f(f1, i1), \
22+
__builtin_##func(d1, i1), \
23+
__builtin_##func##l(l1, i1));
2424

2525
int test_builtins() {
26-
int i1 = 88;
27-
float f1 = 0.1234f;
28-
float f2 = 0.5678f;
29-
double d1 = 1.0101;
30-
double d2 = 0.10101;
31-
long double l1 = 12.0123L;
32-
long double l2 = 21.3201L;
33-
TEST(fmax)
34-
TEST(fmin)
35-
TEST(fmod)
26+
int i1 = 88;
27+
float f1 = 0.1234f;
28+
float f2 = 0.5678f;
29+
double d1 = 1.0101;
30+
double d2 = 0.10101;
31+
long double l1 = 12.0123L;
32+
long double l2 = 21.3201L;
33+
TEST(fmax)
34+
TEST(fmin)
35+
TEST(fmod)
3636

37-
TEST(pow)
38-
TESTI(powi)
39-
return 0;
37+
TEST(pow)
38+
TESTI(powi)
39+
return 0;
4040
}
4141

4242
void test_exp_log(double x) {
43-
double a = exp2(x);
44-
double b = log10(x);
45-
float c = log10f(x);
46-
double d = acos(x);
47-
printf("%f : %f : %f : %d\n", a, b, c, isnan(d));
43+
double a = exp2(x);
44+
double b = log10(x);
45+
float c = log10f(x);
46+
double d = acos(x);
47+
printf("%f : %f : %f : %d\n", a, b, c, isnan(d));
4848
}
4949

5050
void test_long_double(long double x) {
@@ -60,10 +60,10 @@ void test_long_double(long double x) {
6060
}
6161

6262
int main() {
63-
puts("***start***");
64-
test_builtins();
65-
test_exp_log(1234.5678);
66-
test_long_double(16);
67-
puts("***end***");
68-
return 0;
63+
puts("***start***");
64+
test_builtins();
65+
test_exp_log(1234.5678);
66+
test_long_double(16);
67+
puts("***end***");
68+
return 0;
6969
}

tests/core/test_float_builtins.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
***start***
2-
0.567800 : 1.010100 : 21.320100
3-
0.123400 : 0.101010 : 12.012300
4-
0.123400 : 0.101010 : 12.012300
5-
0.304824 : 1.001016 : 104168858480774530203648.000000
6-
0.000000 : 2.421390 : 101648962858951235671184182497867417669061891127967232769386628692937206561802464554722378383360.000000
2+
__builtin_fmax 0.567800 : 1.010100 : 21.320100
3+
__builtin_fmin 0.123400 : 0.101010 : 12.012300
4+
__builtin_fmod 0.123400 : 0.101010 : 12.012300
5+
__builtin_pow 0.304824 : 1.001016 : 104168858480774530203648.000000
6+
__builtin_powi 0.000000 : 2.421390 : 101648962858951235671184182497867417669061891127967232769386628692937206561802464554722378383360.000000
77
inf : 3.091515 : 3.091515 : 1
88
sqrt(x) = 4.000000
99
ceil(x) = 16.000000

0 commit comments

Comments
 (0)