Skip to content

Commit

Permalink
Merge branch 'UnitTests' into dev_merge_may2024
Browse files Browse the repository at this point in the history
  • Loading branch information
kerim aydin committed May 22, 2024
2 parents 17bb8cd + 933b135 commit 387c41d
Show file tree
Hide file tree
Showing 96 changed files with 119 additions and 166 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ src/*.dll
tests/testthat/data/output/*
tests/testthat/data/bkup/*
tests/testthat/data/input/REcosystem_Current_*.dat
tests/testthat/data/input/REcosystem_Current_*.rds
tests/testthat/data/input/REcosystem_Current_*.csv
tests/testthat/old/*
tests/testthat/bkup/*
tests/testthat/old dat files/*
docs
doc
Meta
Rpath.Rproj
Rpath.Rproj
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Suggests:
generics,
testthat (>= 3.0.0)
VignetteBuilder: knitr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
URL: https://github.com/NOAA-EDAB/Rpath
BugReports: https://github.com/NOAA-EDAB/Rpath/issues
Depends:
Expand Down
2 changes: 1 addition & 1 deletion man/MTI.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/Rpath-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/adjust.forcing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/check.rpath.params.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create.rpath.params.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/extract.node.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/frate.table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/read.rpath.params.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/rpath.groups.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/rpath.stanzas.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/stanzaplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/webplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/write.Rpath.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/write.Rsim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/write.rpath.params.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ecosim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ List rk4_run (List params, List instate, List forcing, List fishing, List stanza

// If biomass goes crazy or hits NA, exit loop with crash signal. Note it
// should still write the NA or INF values back to the output.
if ( any(is_na(cur_Biomass)) | any(is_infinite(cur_Biomass)) | any(is_nan(cur_Biomass)) ) {
if (bool(any(is_na(cur_Biomass))) || bool(any(is_infinite(cur_Biomass))) || bool(any(is_nan(cur_Biomass)))) {
CRASH_YEAR = y; y = EndYear; m = STEPS_PER_YEAR;
}

Expand Down Expand Up @@ -382,7 +382,7 @@ int y, m, dd;
// should still write the NA or INF values back to the output.
//NOJUV make sure crash tests work for juveniles.

if ( any(is_na(cur_Biomass)) | any(is_infinite(cur_Biomass)) | any(is_nan(cur_Biomass)) ) {
if (bool(any(is_na(cur_Biomass))) || bool(any(is_infinite(cur_Biomass))) || bool(any(is_nan(cur_Biomass)))) {
CRASH_YEAR = y; y = EndYear; m = STEPS_PER_YEAR;
}

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/data/input/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ REcosystem_Current_RK4_ForcedCat_OutBiomass_Stepped.rds
REcosystem_Current_RK4_ForcedCat_OutCatch_Jitter.rds
REcosystem_Current_RK4_ForcedCat_OutCatch_Stepped.rds
REcosystem_Current_RK4_ForcedCat_OutGearCatch_Jitter.rds
REcosystem_Current_AB_ForcedBio_OutBiomass_Jitter.rds
36 changes: 18 additions & 18 deletions tests/testthat/data/input/REcosystem_Baseline_AB.csv
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
"","Group","StartBio","EndBio","BioES","StartCatch","EndCatch","CatchES"
"Outside","Outside",1,1,1,0,0,NA
"Seabirds","Seabirds",0.0149,0.0149000421028321,1.00000282569343,1e-05,1.00000282111217e-05,1.00000282111217
"Seabirds","Seabirds",0.0149,0.0149000421028323,1.00000282569344,1e-05,1.00000282111218e-05,1.00000282111218
"Whales","Whales",0.454,0.454000210323487,1.00000046326759,1e-07,1.00000046237396e-07,1.00000046237396
"Seals","Seals",0.0249999999999718,0.0250002188221431,1.00000875288685,0.00200000000413891,0.00200001748905324,1.00000874245715
"JuvRoundfish1","JuvRoundfish1",0.130430485118969,0.130433508003209,1.00002317620944,0.00300000000000001,0.00300006953210303,1.00002317736767
"AduRoundfish1","AduRoundfish1",1.39,1.39005295588287,1.00003809775746,0.145000203632079,0.145005524262104,1.00003669394864
"JuvRoundfish2","JuvRoundfish2",1.23260830921837,1.23259936869508,0.999992746663136,0.003,0.00299997823997374,0.999992746657912
"AduRoundfish2","AduRoundfish2",5.553,5.55298124848838,0.999996623174568,0.389000250489473,0.388998687520254,0.999995982086857
"JuvFlatfish1","JuvFlatfish1",0.0698844163992366,0.0698869780915876,1.00003665613141,0.002,0.00200007328635013,1.00003664317507
"AduFlatfish1","AduFlatfish1",5.766,5.76631154105126,1.00005403070608,0.180000208050261,0.180009721333862,1.00005285151447
"JuvFlatfish2","JuvFlatfish2",0.0962887696620608,0.0962884894227788,0.99999708959536,0.002,0.00199999420098711,0.999997100493556
"AduFlatfish2","AduFlatfish2",0.739,0.739000130647141,1.00000017678909,0.0700000310249589,0.0700000137421647,0.99999975310305
"OtherGroundfish","OtherGroundfish",7.4,7.39994608057505,0.999992713591223,0.379999997272581,0.379997231062138,0.999992720498784
"Foragefish1","Foragefish1",5.1,5.09999811993401,0.999999631359611,0.350999998399263,0.350999870540216,0.999999635729209
"Foragefish2","Foragefish2",4.7,4.70000128223243,1.00000027281541,0.0909999995496743,0.0910000247985853,1.00000027746056
"OtherForagefish","OtherForagefish",5.1,5.09999705474722,0.999999422499456,0.0309999997462498,0.0309999820895145,0.99999943042789
"Megabenthos","Megabenthos",19.7653839645524,19.7653695454297,0.999999270486083,0.189999999090599,0.189999861429518,0.999999275467992
"Shellfish","Shellfish",7,7.00000501432483,1.00000071633212,0.509999999758437,0.51000036523584,1.00000071662236
"Macrobenthos","Macrobenthos",17.4,17.3999776424532,0.99999871508352,9.99999987659067e-05,9.99998715476867e-05,0.999998727817784
"Seals","Seals",0.0249999999999768,0.0250002188221547,1.00000875288712,0.00200000000413891,0.00200001748905377,1.00000874245741
"JuvRoundfish1","JuvRoundfish1",0.130430485118969,0.130433508003186,1.00002317620926,0.003,0.00300006953210249,1.0000231773675
"AduRoundfish1","AduRoundfish1",1.39,1.39005295588256,1.00003809775723,0.145000203632079,0.145005524262072,1.00003669394842
"JuvRoundfish2","JuvRoundfish2",1.23260830921837,1.23259936869507,0.999992746663134,0.003,0.00299997823997373,0.999992746657911
"AduRoundfish2","AduRoundfish2",5.553,5.55298124848836,0.999996623174565,0.389000250489473,0.388998687520253,0.999995982086855
"JuvFlatfish1","JuvFlatfish1",0.0698844163992366,0.069886978091586,1.00003665613139,0.00199999999999999,0.00200007328635009,1.00003664317505
"AduFlatfish1","AduFlatfish1",5.766,5.7663115410512,1.00005403070607,0.180000208050261,0.18000972133386,1.00005285151446
"JuvFlatfish2","JuvFlatfish2",0.0962887696620608,0.0962884894227813,0.999997089595386,0.002,0.00199999420098716,0.999997100493582
"AduFlatfish2","AduFlatfish2",0.739,0.739000130647185,1.00000017678915,0.0700000310249589,0.0700000137421689,0.99999975310311
"OtherGroundfish","OtherGroundfish",7.4,7.39994608057543,0.999992713591274,0.379999997272581,0.379997231062158,0.999992720498835
"Foragefish1","Foragefish1",5.1,5.09999811993404,0.999999631359616,0.350999998399263,0.350999870540218,0.999999635729215
"Foragefish2","Foragefish2",4.7,4.70000128223247,1.00000027281542,0.0909999995496744,0.091000024798586,1.00000027746057
"OtherForagefish","OtherForagefish",5.1,5.09999705474727,0.999999422499466,0.0309999997462498,0.0309999820895149,0.9999994304279
"Megabenthos","Megabenthos",19.7653839645524,19.7653695454297,0.999999270486081,0.189999999090599,0.189999861429517,0.99999927546799
"Shellfish","Shellfish",7,7.00000501432484,1.00000071633212,0.509999999758437,0.51000036523584,1.00000071662236
"Macrobenthos","Macrobenthos",17.4,17.3999776424533,0.999998715083521,9.99999987659068e-05,9.99998715476867e-05,0.999998727817784
"Zooplankton","Zooplankton",23,23.000000629589,1.00000002737344,0,0,NA
"Phytoplankton","Phytoplankton",10,9.99999972809651,0.999999972809651,0,0,NA
"Detritus","Detritus",3636.66711075279,3636.66738830137,1.00000007631949,0,0,NA
"Discards","Discards",1.2182202,1.21823092208955,1.00000880143799,0,0,NA
"Discards","Discards",1.2182202,1.21823092208953,1.00000880143798,0,0,NA
"Trawlers","Trawlers",0,0,NA,0,0,NA
"Midwater","Midwater",0,0,NA,0,0,NA
"Dredgers","Dredgers",0,0,NA,0,0,NA
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/testthat/data/input/REcosystem_Baseline_AB_OutBiomass.rds
Binary file not shown.
Binary file modified tests/testthat/data/input/REcosystem_Baseline_AB_OutCatch.rds
Binary file not shown.
Binary file modified tests/testthat/data/input/REcosystem_Baseline_AB_OutGearCatch.rds
Binary file not shown.
36 changes: 18 additions & 18 deletions tests/testthat/data/input/REcosystem_Baseline_RK4.csv
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
"","Group","StartBio","EndBio","BioES","StartCatch","EndCatch","CatchES"
"Outside","Outside",1,1,1,0,0,NA
"Seabirds","Seabirds",0.0149,0.0149000414705202,1.00000278325639,9.99999999999475e-06,1.00000277870872e-05,1.00000277870925
"Seabirds","Seabirds",0.0149,0.0149000414705204,1.0000027832564,9.99999999999475e-06,1.00000277870874e-05,1.00000277870926
"Whales","Whales",0.454,0.454000203549876,1.00000044834774,9.99999999999199e-08,1.00000044748892e-07,1.00000044748972
"Seals","Seals",0.0249999999999718,0.0250002151253163,1.00000860501378,0.00200000000272358,0.00200001719370259,1.00000859548949
"JuvRoundfish1","JuvRoundfish1",0.130430485118969,0.130433509907448,1.00002319080909,0.00299999999941579,0.00300006722470278,1.000022408429
"AduRoundfish1","AduRoundfish1",1.39,1.3900529699139,1.00003810785173,0.145000201253226,0.145005476873034,1.00003638353438
"JuvRoundfish2","JuvRoundfish2",1.23260830921836,1.23259937159164,0.999992749013086,0.00299999999971644,0.00299997893978356,0.99999298002237
"AduRoundfish2","AduRoundfish2",5.553,5.55298128970033,0.999996630596134,0.389000247694946,0.388998687736761,0.999995989827272
"JuvFlatfish1","JuvFlatfish1",0.0698844163992366,0.0698869785491005,1.00003666267812,0.00199999999751022,0.00200007140577223,1.00003570413105
"AduFlatfish1","AduFlatfish1",5.766,5.76631158759197,1.00005403877766,0.180000206280042,0.180009663891873,1.00005254222774
"JuvFlatfish2","JuvFlatfish2",0.0962887696620608,0.0962884904713711,0.999997100485439,0.00199999999817096,0.00199999422811603,0.999997114972532
"AduFlatfish2","AduFlatfish2",0.739000000000001,0.739000142115137,1.00000019230736,0.0700000308235379,0.0700000121018634,0.999999732547625
"OtherGroundfish","OtherGroundfish",7.4,7.39994606118236,0.999992710970589,0.37999999816591,0.379997230076909,0.999992715555226
"Foragefish1","Foragefish1",5.1,5.09999812442392,0.999999632239984,0.3509999989451,0.350999870850301,0.999999635057553
"Foragefish2","Foragefish2",4.7,4.700001283549,1.00000027309553,0.0909999997037419,0.0910000248242094,1.00000027604909
"OtherForagefish","OtherForagefish",5.1,5.09999704663004,0.999999420907851,0.0309999998356158,0.0309999820405001,0.999999425964008
"Megabenthos","Megabenthos",19.7653839645524,19.7653694849668,0.999999267427051,0.189999999383839,0.18999986084728,0.999999270860213
"Seals","Seals",0.0249999999999768,0.0250002151253278,1.00000860501404,0.00200000000272359,0.00200001719370312,1.00000859548975
"JuvRoundfish1","JuvRoundfish1",0.130430485118969,0.130433509907425,1.00002319080891,0.00299999999941577,0.00300006722470225,1.00002240842883
"AduRoundfish1","AduRoundfish1",1.39,1.39005296991359,1.00003810785151,0.145000201253226,0.145005476873002,1.00003638353416
"JuvRoundfish2","JuvRoundfish2",1.23260830921836,1.23259937159164,0.999992749013083,0.00299999999971644,0.00299997893978355,0.999992980022369
"AduRoundfish2","AduRoundfish2",5.553,5.55298128970031,0.999996630596131,0.389000247694946,0.38899868773676,0.999995989827268
"JuvFlatfish1","JuvFlatfish1",0.0698844163992366,0.0698869785490991,1.0000366626781,0.00199999999751021,0.00200007140577219,1.00003570413104
"AduFlatfish1","AduFlatfish1",5.766,5.76631158759191,1.00005403877765,0.180000206280042,0.180009663891871,1.00005254222773
"JuvFlatfish2","JuvFlatfish2",0.0962887696620608,0.0962884904713736,0.999997100485466,0.00199999999817096,0.00199999422811608,0.999997114972557
"AduFlatfish2","AduFlatfish2",0.739000000000001,0.73900014211518,1.00000019230741,0.070000030823538,0.0700000121018677,0.999999732547685
"OtherGroundfish","OtherGroundfish",7.4,7.39994606118274,0.999992710970641,0.37999999816591,0.379997230076929,0.999992715555277
"Foragefish1","Foragefish1",5.1,5.09999812442395,0.999999632239989,0.3509999989451,0.350999870850303,0.999999635057559
"Foragefish2","Foragefish2",4.7,4.70000128354904,1.00000027309554,0.0909999997037419,0.0910000248242102,1.0000002760491
"OtherForagefish","OtherForagefish",5.1,5.09999704663009,0.999999420907861,0.0309999998356158,0.0309999820405005,0.999999425964018
"Megabenthos","Megabenthos",19.7653839645524,19.7653694849667,0.99999926742705,0.189999999383839,0.189999860847279,0.999999270860211
"Shellfish","Shellfish",7,7.00000502602804,1.00000071800401,0.509999999875786,0.510000366087145,1.00000071806149
"Macrobenthos","Macrobenthos",17.4,17.3999776323994,0.999998714505715,9.99999992742293e-05,9.99998714891689e-05,0.999998722149387
"Macrobenthos","Macrobenthos",17.4,17.3999776323995,0.999998714505716,9.99999992742293e-05,9.9999871489169e-05,0.999998722149387
"Zooplankton","Zooplankton",23,23.000000626978,1.00000002725991,0,0,NA
"Phytoplankton","Phytoplankton",10,9.99999972903496,0.999999972903496,0,0,NA
"Phytoplankton","Phytoplankton",10,9.99999972903497,0.999999972903497,0,0,NA
"Detritus","Detritus",3636.66711075279,3636.66738627725,1.0000000757629,0,0,NA
"Discards","Discards",1.2182202,1.21823082510863,1.0000087218293,0,0,NA
"Discards","Discards",1.2182202,1.21823082510862,1.00000872182929,0,0,NA
"Trawlers","Trawlers",0,0,NA,0,0,NA
"Midwater","Midwater",0,0,NA,0,0,NA
"Dredgers","Dredgers",0,0,NA,0,0,NA
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/testthat/data/input/REcosystem_Baseline_RK4_OutBiomass.rds
Binary file not shown.
Binary file modified tests/testthat/data/input/REcosystem_Baseline_RK4_OutCatch.rds
Binary file not shown.
Binary file modified tests/testthat/data/input/REcosystem_Baseline_RK4_OutGearCatch.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions tests/testthat/test-constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ CREATE_BASELINE_FILES <- FALSE

NUMBER_OF_STEPS <- 5 # should be an odd multiple of nrows=600 (i.e., 5,15,30)
FACTOR_VALUE <- 5
SEED_VALUE <- 1
SEED_OFFSET <- 2000
SEED_VALUE <- 7
TOLERANCE_VALUE <- 1e-5
RUN_QUIET <- TRUE
YLIMIT_DIFFERENCE_PLOTS <- 0.05
Expand Down
Loading

0 comments on commit 387c41d

Please sign in to comment.