I'm new on Boost.Test on Visual Studio 2017.
I'm trying to test a method with the following Test:
#define BOOST_TEST_MODULE astroTimeTests
#include <boost/test/included/unit_test.hpp>
#include <ctime>
#include "../../AstroTime/Convert.h"
struct TestFixture
{
Convert convert_instance;
TestFixture()
: convert_instance()
{}
~TestFixture() = default;
};
BOOST_FIXTURE_TEST_SUITE(TestConvert, TestFixture)
BOOST_AUTO_TEST_CASE(julianToGreenWichCase)
{
// http://www.onlineconversion.com/julian_date.htm
tm day1 = { 12, 28, 16, 2, 10, 119, 0, 0, 0};
BOOST_REQUIRE_EQUAL(day1, convert_instance.JulianToGreenWich(2458790.18625f));
}
BOOST_AUTO_TEST_SUITE_END()
JulianToGreenWich
returns a tm
struct from ctime
.
But I'm doing something wrong, because I get the following errors:
Error C2678 binary '==': no operator found which takes a left-hand operand of type 'const Left' (or there is no acceptable conversion)
Error C2338 Type has to implement operator<< to be printable
Error C2679 binary '<<': no operator found which takes a right-hand operand of type 'const T' (or there is no acceptable conversion)
How can I test if both values, day1
and the result of JulianToGreenWich
are equal?
This is how I have fixed this error: