Biblioteka boost- własne testy
Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?
Zarejestruj się!

Biblioteka boost- własne testy

AutorWiadomość
Temat założony przez niniejszego użytkownika
Biblioteka boost- własne testy
» 2017-12-29 15:47:59
Witam zapoznałem się z tutejszym poradnikiem odnoście testów jednostkowych i działają, ale mam takie pytanie muszę przetestować własną klasę ułamek i mam w niej przeciążone operatory + - itp.
1. Jak mogę pisać testy w osobnym pliku cpp (nie w tym samym co implementacja klasy)
2. Mam testy stworzone w pliku z implementacją klasy ale mam też plik main.cpp a w nim metodę int main(); gdy chcę ją uruchomić to dostaję błąd

/Applications/CLion.app/Contents/bin/cmake/bin/cmake --build /Users/michael.urban/CLionProjects/fraction/cmake-build-debug --target fraction -- -j 2
Scanning dependencies of target fraction
[ 33%] Building CXX object CMakeFiles/fraction.dir/source/Fraction.cpp.o
[ 66%] Linking CXX executable fraction
Undefined symbols for architecture x86_64:
  "boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)", referenced from:
      MatematykaSuite::testOdejmij::test_method() in Fraction.cpp.o
  "boost::unit_test::unit_test_log_t::set_checkpoint(boost::unit_test::basic_cstring<char const>, unsigned long, boost::unit_test::basic_cstring<char const>)", referenced from:
      MatematykaSuite::testOdejmij_invoker() in Fraction.cpp.o
      MatematykaSuite::testOdejmij::test_method() in Fraction.cpp.o
  "boost::unit_test::test_case::test_case(boost::unit_test::basic_cstring<char const>, boost::unit_test::basic_cstring<char const>, unsigned long, boost::function<void ()> const&)", referenced from:
      boost::unit_test::make_test_case(boost::function<void ()> const&, boost::unit_test::basic_cstring<char const>, boost::unit_test::basic_cstring<char const>, unsigned long) in Fraction.cpp.o
  "boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::basic_cstring<char const>, boost::unit_test::basic_cstring<char const>, unsigned long, boost::unit_test::decorator::collector&)", referenced from:
      ___cxx_global_var_init.2 in Fraction.cpp.o
  "boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)", referenced from:
      ___cxx_global_var_init.5 in Fraction.cpp.o
  "boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(int)", referenced from:
      ___cxx_global_var_init.8 in Fraction.cpp.o
  "boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)", referenced from:
      boost::unit_test::make_test_case(boost::function<void ()> const&, boost::unit_test::basic_cstring<char const>, boost::unit_test::basic_cstring<char const>, unsigned long) in Fraction.cpp.o
  "vtable for boost::unit_test::unit_test_log_t", referenced from:
      boost::unit_test::unit_test_log_t::unit_test_log_t() in Fraction.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [fraction] Error 1
make[2]: *** [CMakeFiles/fraction.dir/all] Error 2
make[1]: *** [CMakeFiles/fraction.dir/rule] Error 2
make: *** [fraction] Error 2

google nie pomaga :(
P-168204
« 1 »
 Strona 1 z 1