Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature enhancement#118 times unit test #192

Merged
merged 38 commits into from
Jul 26, 2018

Conversation

nip5
Copy link
Contributor

@nip5 nip5 commented Jun 13, 2018

Merge into master unit test for Times.c function interpolate_monthlyValues.

@nip5 nip5 added this to the Code testing milestone Jun 13, 2018
@nip5 nip5 requested a review from CaitlinA June 13, 2018 20:49
interpolate -> cloudcov[11] = 12;
interpolate_monthlyValues(interpolate -> cloudcov, interpolate -> cloudcov_daily);
EXPECT_DOUBLE_EQ(interpolate -> cloudcov_daily[365], 16.129032258064516);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an expectation for MAX_DAYS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, I forgot about the leap year!

@dschlaep
Copy link
Member

This PR references to an updated commit of the googletest submodule. Please don't do that without accounting for #206 (particularly as addressed by commit 5baeec0)

@nip5
Copy link
Contributor Author

nip5 commented Jul 10, 2018

How should I address #206 here? Checkout googletest one commit before this problem was introduced as google/googletest@87a4cdd does?

@dschlaep
Copy link
Member

  • cherry pick 5baeec0 for now
  • don't update the googletest submodule in the future without specific efforts and dedicated commit

@nip5
Copy link
Contributor Author

nip5 commented Jul 11, 2018

I didn't make any efforts to update it on my branch, the only way I see that it could have been updated is when I merged in master to my branch. By cherry pick do you mean just do what you did in that commit, replace my googletest directory and make the change in .gitmodules?

@dschlaep
Copy link
Member

@dschlaep
Copy link
Member

I just had the same failure at PR #209 and opened a new issue for this (#210) -- until #210 is fixed, you need to manually restart the build on appveyor.

@nip5
Copy link
Contributor Author

nip5 commented Jul 11, 2018

How can that be done without doing a new commit? I have been able to find that is possible but no reliable source saying how to do it, the best I've found is "there is a button"; I don't see a button.

@codecov
Copy link

codecov bot commented Jul 25, 2018

Codecov Report

Merging #192 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #192      +/-   ##
==========================================
+ Coverage   60.68%   60.71%   +0.02%     
==========================================
  Files          19       19              
  Lines        3584     3584              
==========================================
+ Hits         2175     2176       +1     
+ Misses       1409     1408       -1
Impacted Files Coverage Δ
Times.c 45.32% <100%> (ø) ⬆️
SW_SoilWater.c 55.2% <100%> (ø) ⬆️
rands.c 48.02% <0%> (+0.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6684d64...833cc72. Read the comment docs.

@nip5
Copy link
Contributor Author

nip5 commented Jul 25, 2018

@CaitlinA This branch is ready for review.

Copy link
Member

@CaitlinA CaitlinA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Nathan,

I am only address the changes to the Times.c files here. I imagine there are differences in test_SW_Soilwater.cc on your other branch.

I only have comments about comments, not any of the test themselves.

The googletest folder changes, is this because the master updated the googletest submodule and you pulled down these changes to your branch?

SW_SKY SW_Sky;
SW_SKY *interpolate = &SW_Sky;
unsigned int i;
// set all monthlyValues all 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// set all monthly values to 10?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, since the test relies on the values here, I need to know exactly what the values are in order to test properly. Setting them all to 10 ensures this. I will add this to the comment to be more clear.

for (i = 0; i < length(interpolate -> cloudcov); i++){
interpolate -> cloudcov[i] = 10;
}
interpolate -> cloudcov_daily[0] = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have to specifically so cloudcov_daily[0] to 0 here? Should this be part of the functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that to illustrate that cloudcov_daily[0] does not change by setting it before the function call than testing that is still that value afterwords. The function does not modify this value so it is whatever it is before the call.

Reset_SOILWAT2_after_UnitTest();

// change first value to 20 and test the changes
interpolate -> cloudcov[0] = 20;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you actually test these changes? Could you clarify your message to something like change first value to a value to test if .....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, changing cloudcov[0] translates to changing the cloud cover in January, which changes the interpolation of all the days. I test these changes underneath this initialization.

EXPECT_DOUBLE_EQ(interpolate -> cloudcov_daily[365], 15.161290322580644);
// test last day on leap year
EXPECT_DOUBLE_EQ(interpolate -> cloudcov_daily[MAX_DAYS], 15.483870967741936);
// change december monthly value to ensure meaningful final interpolation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add more enter / space around new test conditions to clarify

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean have a space for every EXPECT? Ie.
EXPECT_EQ

EXPECT_EQ

   ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - I mean when ever you change the the input conditions, add more breaks. So enter after line 61.

@nip5
Copy link
Contributor Author

nip5 commented Jul 26, 2018

Yes, the googltest file changed in master so when merging into my branch it changed mine as well.

@CaitlinA
Copy link
Member

closes #118

@CaitlinA CaitlinA closed this Jul 26, 2018
@CaitlinA CaitlinA reopened this Jul 26, 2018
@nip5
Copy link
Contributor Author

nip5 commented Jul 26, 2018

What needs to be done now before we can merge the pull request and delete this branch?

@CaitlinA CaitlinA merged commit 9d29bdf into master Jul 26, 2018
@CaitlinA
Copy link
Member

Closes #118

@CaitlinA CaitlinA deleted the feature_Enhancement#118_TimesUnitTests branch July 26, 2018 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants