Skip to content

Commit 6440dff

Browse files
committed
Layout
1 parent 1ee5c82 commit 6440dff

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

unitttest/unittest

1.1 MB
Binary file not shown.

unitttest/unittest.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,20 @@ static void testEncodeAndDecode(const char *str, double y, double x, int localso
122122
double lat, lon;
123123
int precision = MAX_PRECISION_DIGITS;
124124

125-
if (y < -90) { y = -90; } else if (y > 90) { y = 90; }
125+
if (y < -90) {
126+
y = -90;
127+
} else if (y > 90) {
128+
y = 90;
129+
}
126130

127131
// if str: determine "precision", territory "tc", and a "clean" copy of str
128132
if (*str) {
129133
char territory[MAX_ISOCODE_LEN + 1];
130134
// find first territory letter in s
131135
s = str;
132-
while (*s > 0 && *s <= 32) { s++; }
136+
while (*s > 0 && *s <= 32) {
137+
s++;
138+
}
133139
// parse territory, if any
134140
p = strchr(s, ' ');
135141
len = p ? (int) (p - s) : 0;
@@ -140,7 +146,9 @@ static void testEncodeAndDecode(const char *str, double y, double x, int localso
140146
tc = convertTerritoryIsoNameToCode(territory, 0);
141147
// make s skip to start of proper mapcode
142148
s = p;
143-
while (*s > 0 && *s <= 32) { s++; }
149+
while (*s > 0 && *s <= 32) {
150+
s++;
151+
}
144152
} else {
145153
// assume s is the start of the proper mapcode
146154
*territory = 0;
@@ -149,7 +157,9 @@ static void testEncodeAndDecode(const char *str, double y, double x, int localso
149157

150158
// build normalised version of source string in "clean"
151159
len = (int) strlen(s);
152-
while (len > 0 && s[len - 1] > 0 && s[len - 1] <= 32) { len--; }
160+
while (len > 0 && s[len - 1] > 0 && s[len - 1] <= 32) {
161+
len--;
162+
}
153163
i = (int) strlen(territory);
154164
if (i) {
155165
strcpy(clean, territory);
@@ -382,7 +392,9 @@ void encode_decode_tests() {
382392
printf("%d encodes\n", nr);
383393
for (i = 0; i < nr; i++) {
384394
const encode_test_record *t = &encode_test[i];
385-
if ((i & 255) == 0) { fprintf(stderr, "%0.1f%%\r", i * 100.0 / nr); }
395+
if ((i & 255) == 0) {
396+
fprintf(stderr, "%0.1f%%\r", i * 100.0 / nr);
397+
}
386398
testEncodeAndDecode(t->mapcode, t->latitude, t->longitude, t->nr_local_mapcodes, t->nr_global_mapcodes);
387399
}
388400
}

0 commit comments

Comments
 (0)