-
Notifications
You must be signed in to change notification settings - Fork 2
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
Setup unit test framework without the need to include source files #82
Comments
- addressing issue #82 - Remove source files from test/*.cc unit test files - link SOILWAT2-library to 'test' target of make - however, this does not compile and errors out with > Undefined symbols for architecture x86_64: "RandBeta(float, float)", referenced from: (anonymous namespace)::BetaGeneratorTest_ZeroToOneOutput_Test::TestBody() in test_rands-0f5d64.o (anonymous namespace)::BetaGeneratorDeathTest_Errors_Test::TestBody() in test_rands-0f5d64.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't understand why I get Maybe the problem is that I compile
|
- defined CC, CFLAGS, CXX, CXXFLAGS, and LDIBS - specified target architecture (as this was mentioned online that different steps may target different architectures and that this may be the problem underlying issue #82 -- but it didn't help) - initialize global variable in main() of unit tests - realized that linking with the libmath also works on macOS if done correctly --> removed target 'binl'
- bad practice, see issue #82 which remains unsolved - I want this branch to be merged into master so that I can use the last set of commits as basis for development in other branches. sorry.
- removed compiler flag '-arch' because it didn't help addressing issue #82
- avoid compiler warnings "warning: parameter set but not used" - remove explicit definition of CC and CXX (e.g., so that CIs can set their own, e.g., on travis we want to test with both clang and gnu gcc) - add SOILWAT2 library to LDLIBS instead (now needs LDFLAGS) - still does not resolve issue #82 - apparently, compilers on my machine produce different warnings/errors than travis-ci and appveyor-ci (I can compile without warnings/errors while they produce warnings and error out)
When I include the SOILWAT2 source files as library to link to my unit test executable, it fails with
When I list the SOILWAT2 source files directly in the compile command, it works:
It produces warnings So I should compile a c++ version of |
- now close #82 We still cannot include SW_Output.c when unit testing: * "error: cannot increment expression of enum type" (e.g., OutKey, OutPeriod) * "error: assigning to 'OutKey' from incompatible type 'int'", and similar cases --> for now, exclude SW_Output.c (see new issue #85), work on fixing the errors under c++ and then - address c++ compile "warning: ISO C++11 does not allow conversion from string literal to 'char *'" --> don't define such variables as "char *" but instead as "char const *" (see https://stackoverflow.com/questions/20944784/why-is-conversion-from-stri ng-constant-to-char-valid-in-c-but-invalid-in-c#20944858)
Currently, unit tests only compile if the test/*.cc files
#include "SW_*.c"
the relevant SOILWAT2 source files.This is obviously bad. We need to set up our unit test framework without the need to include source files
The text was updated successfully, but these errors were encountered: