Skip to content

Commit

Permalink
updated unittest workflow, will need cmake to build the model now (mo…
Browse files Browse the repository at this point in the history
…re consistent with other four cfe tests).
  • Loading branch information
ajkhattak committed Jul 21, 2023
1 parent 138cb43 commit d721d7a
Show file tree
Hide file tree
Showing 7 changed files with 477 additions and 458 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ option(FORCING "FORCING" OFF)
option(FORCINGPET "FORCINGPET" OFF)
option(AETROOTZONE "AETROOTZONE" OFF)
option(NGEN "NGEN" OFF)
option(UNITTEST "UNITTEST" OFF)

if(NOT BASE AND NOT FORCING AND NOT FORCINGPET AND NOT AETROOTZONE AND NOT NGEN)
message("${Red}Options: BASE, FORCING, FORCINGPET, AETROOTZONE, NGEN" ${ColourReset})
if( (NOT BASE) AND (NOT FORCING) AND (NOT FORCINGPET) AND (NOT AETROOTZONE) AND (NOT NGEN) AND (NOT UNITTEST) )
message("${Red}Options: BASE, FORCING, FORCINGPET, AETROOTZONE, NGEN, UNITTEST" ${ColourReset})
message(FATAL_ERROR "Invalid option is provided, CMake will exit." )
endif()

Expand All @@ -37,6 +38,9 @@ message("${Red} CFE BUILD 'FORCING AND PET AND ROOTZONE-BASED AET' CASE!${Colour
set(exe_name "cfe_aet_rootzone")
elseif(NGEN)
message("${Red} CFE BUILD NGEN CASE!${ColourReset}")
elseif(UNITTEST)
message("${Red} CFE BUILD UNITTEST CASE!${ColourReset}")
set(exe_name "cfe_unittest")
endif()

# set the project name
Expand Down Expand Up @@ -69,6 +73,8 @@ elseif(FORCINGPET)
add_executable(${exe_name} ./src/main_cfe_aorc_pet.c ./src/cfe.c ./src/bmi_cfe.c ./src/giuh.c ./src/conceptual_reservoir.c ./extern/aorc_bmi/src/aorc.c ./extern/aorc_bmi/src/bmi_aorc.c ./extern/evapotranspiration/src/pet.c ./extern/evapotranspiration/src/bmi_pet.c)
elseif(BASE)
add_executable(${exe_name} ./src/main.c ./src/cfe.c ./src/bmi_cfe.c ./src/giuh.c ./src/conceptual_reservoir.c)
elseif(UNITTEST)
add_executable(${exe_name} ./test/main_unit_test.c ./src/cfe.c ./src/bmi_cfe.c ./src/giuh.c ./src/conceptual_reservoir.c)
endif()


Expand Down
2 changes: 1 addition & 1 deletion configs/cat_89_bmi_config_cfe_unit_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ K_lf=0.01[]
nash_storage=0.0,0.0
giuh_ordinates=0.06,0.51,0.28,0.12,0.03
num_timesteps=1
verbosity=0
verbosity=2
surface_partitioning_scheme=Schaake
3 changes: 2 additions & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ New BMI components introduced are categorized as follows,

We will fully examine functionality of all applicable definitions.

To run the BMI component unit test, simply run `./make_and_run_bmi_unit_test.sh` within this [test](./make_and_run_bmi_unit_test.sh) directory.
Build BMI unit test: `mkdir build && cd build && cmake .. -DUNITTEST=ON && make && cd ..` (witin cfe directory)
Run BMI unit test: `./run_unittest.sh` (within test directory)

The script uses a catchment-89 configuration found [here](../configs/cat_89_bmi_config_cfe_unit_test.txt).
Note that the actual testing loop is much smaller than the number of time steps or end time generated via configuration file or otherwise.
Expand Down
Loading

0 comments on commit d721d7a

Please sign in to comment.