I am pretty new to C++ and am trying out Microsoft CPPunit testing with a simple Add function.
Referring to the screenshot below, I am unable to get the test to work when I click on run all.
The Add function works fine in the main function, but when try to test it in the test cpp file, the build is not able to be completed due to these error messages which I do not understand.
This is the simple Add function:
double Add(double x, double y) {double sum = x + y;return sum;}
May I get some help and clarification on this.
Thanks:)
#include "pch.h"
#include "CppUnitTest.h"
#include "../Calculator/Arith.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTest1
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(TestMethod1)
{
double expected = 10.0;
double actual = Add(5.0, 5.0);
Assert::AreEqual(expected, actual);
}
};
}