forked from fluxnet/ONEFlux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62dbfea
commit 90d3ab7
Showing
4 changed files
with
1,711 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# enables most optimization flags | ||
CC := gcc -O3 | ||
|
||
TEST01_SRC := test_01.c | ||
TEST01_OBJ := $(TEST01_SRC:.c=.o) | ||
TEST01_BIN := $(join ${TGTDIR}, test_01) | ||
|
||
${TEST01_BIN}: | ||
@echo "Building ${TEST01_BIN}..." | ||
${CC} -w -c ${TEST01_SRC} ;\ | ||
${CC} ${TEST01_OBJ} -w -lm -o ${TEST01_BIN} | ||
|
||
clean: | ||
@echo "Cleaning up..." | ||
rm -vf ${TEST01_OBJ} ; rm -vf ${TEST01_BIN} | ||
@echo "Done cleaning up" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
test_01.c | ||
check library output for reference: | ||
Running suite(s): Meteo | ||
66%: Checks: 3, Failures: 1, Errors: 0 | ||
test_01.c:13:F:Sanity checks:sanity_check:0: this should fail | ||
test_01.c:18:P:Sanity checks:sanity_check_2:0: Passed | ||
test_01.c:53:P:Dataset files:test_is_valid_era_filename:0: Passed | ||
*/ | ||
|
||
#include "utest_oneflux.h" | ||
#include "../../oneflux_steps/common/common.c" | ||
#include "../../oneflux_steps/meteo_proc/src/dataset.c" | ||
|
||
/* | ||
dataset.c needs some external variables | ||
*/ | ||
char *qc_auto_files_path = NULL; /* mandatory */ | ||
char *era_files_path = NULL; /* mandatory */ | ||
char *output_files_path = NULL; /* mandatory */ | ||
|
||
UTEST(sanity_check, 1) | ||
{ | ||
FAIL_UNLESS(5 == 5, "this should succeed"); | ||
FAIL_UNLESS(6 == 5, "this should fail"); | ||
} | ||
|
||
UTEST(sanity_check, 2) | ||
{ | ||
FAIL_UNLESS(5 == 5, "this should succeed"); | ||
} | ||
|
||
UTEST(test_is_valid_era_filename, 1) | ||
{ | ||
char* filename; | ||
|
||
filename = ""; | ||
|
||
/* CK_ASSERT_MSG: Fails test if supplied condition evaluates to false and displays user provided message. */ | ||
|
||
CK_ASSERT_MSG(!is_valid_era_filename(filename), "False should be returned for this string: '%s'", filename); | ||
|
||
filename = " - _9999.csv"; | ||
CK_ASSERT_MSG(is_valid_era_filename(filename), "True should be returned for this string: %s", filename); | ||
|
||
filename = ""; | ||
CK_ASSERT_MSG(!is_valid_era_filename(filename), "False should be returned for this string: %s", filename); | ||
|
||
// example of a correct string | ||
filename = "US-ARc_2009.csv"; | ||
CK_ASSERT_MSG(is_valid_era_filename(filename), "True should be returned for this string: %s", filename); | ||
} | ||
|
||
/* | ||
PLEASE NOTE: | ||
we can use 'UTEST_MAIN' instead of call 'UTEST_STATE' and 'main' | ||
but in this way we can do our own stuff like load files and so on... | ||
*/ | ||
|
||
UTEST_STATE(); | ||
|
||
int main(int argc, const char *const argv[]) | ||
{ | ||
/* do your own stuff here! */ | ||
|
||
return utest_main(argc, argv); | ||
} |
Oops, something went wrong.