Skip to content

Commit b83af01

Browse files
committed
Fixing tests.
1 parent 215db7b commit b83af01

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

qdipole/mlt_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
5858
status = c_eval_mlt(mlt, qdlon, time, n_data);
5959

6060
if (status) {
61-
fprintf(stderr, "Call to c_eval_mlt() failed with an error! error_code = %d", status);
61+
fprintf(stderr, "ERROR: Call to c_eval_mlt() failed with an error! error_code = %d\n", status);
6262
return 1;
6363
}
6464

qdipole/qdlatlon_test.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ int main(int argc, char* argv[])
6464
}
6565
printf("Using: %s\n", basename(fname));
6666

67+
if (strlen(fname) > get_max_fname_lenght())
68+
{
69+
fprintf(stderr, "ERROR: Filename is too long and exceeds the maximum allowed %d bytes! filename = %s\n", get_max_fname_lenght(), fname);
70+
return 1;
71+
}
72+
6773
for (i = 0; i < N; ++i)
6874
{
6975
qdlon1[i] = 0.0;
@@ -80,15 +86,15 @@ int main(int argc, char* argv[])
8086
status = c_eval_qdlatlon(qdlat1, qdlon1, time, gcrad, gclat, gclon, n_data, fname);
8187

8288
if (status) {
83-
fprintf(stderr, "Call to c_eval_qdlatlon() failed with an error! error_code = %d", status);
89+
fprintf(stderr, "ERROR: Call to c_eval_qdlatlon() failed with an error! error_code = %d\n", status);
8490
return 1;
8591
}
8692

8793
status = c_eval_qdlatlonvb(qdlat2, qdlon2, f11, f12, f21, f22, f,
8894
time, gcrad, gclat, gclon, n_data, fname);
8995

9096
if (status) {
91-
fprintf(stderr, "Call to c_eval_qdlatlonvb() failed with an error! error_code = %d", status);
97+
fprintf(stderr, "ERROR: Call to c_eval_qdlatlonvb() failed with an error! error_code = %d\n", status);
9298
return 1;
9399
}
94100

qdipole/run_dipole_test

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@ run_test() {
99
EXPECTED_RESULT="$1"
1010
shift
1111
echo -n "$@" " "
12-
RESULT="$("$@" | diff - "$EXPECTED_RESULT")"
12+
TEST_OUTPUT="$( "$@" 2>&1 )"
13+
if [ "$?" != "0" ]
14+
then
15+
echo "FAILED"
16+
echo $TEST_OUTPUT
17+
return 1
18+
fi
1319

14-
if [ "$?" != "0" -o -n "$RESULT" ]
20+
TEST_OUTPUT_DIFF="$( echo "$TEST_OUTPUT" | diff - "$EXPECTED_RESULT" )"
21+
if [ "$?" != "0" -o -n "$TEST_OUTPUT_DIFF" ]
1522
then
1623
echo "FAILED"
17-
echo $RESULT
24+
echo $TEST_OUTPUT_DIFF
1825
return 1
1926
fi
2027
echo "OK"

qdipole/subsol_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
5656
status = c_eval_subsol(sbsllat, sbsllon, time, n_data);
5757

5858
if (status) {
59-
fprintf(stderr, "Call to c_eval_subsol() failed with an error! error_code = %d", status);
59+
fprintf(stderr, "ERROR: Call to c_eval_subsol() failed with an error! error_code = %d\n", status);
6060
return 1;
6161
}
6262

0 commit comments

Comments
 (0)