tags:

views:

21

answers:

1

I'm doing something wrong but I do not know what. Here are my files:

//main
#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{

    return 0;
}


//MyFoo.h
#pragma once
#include "stdafx.h"
class MyFoo
{
public:
    MyFoo(void){};
    int multiplyByTwo(int value);
    ~MyFoo(void){};
};

//MyFoo.cpp
#include "stdafx.h"
#include "Myfoo.h"
int MyFoo::multiplyByTwo(int value)
{
    return value * 2;
}

//MyFoo_Test.cpp
#include "stdafx.h"
#include "Myfoo.h"

#define BOOST_TEST_MODULE MyTest 
#include <boost/test/unit_test.hpp> 

BOOST_AUTO_TEST_CASE( my_test ) 
{ 
    MyFoo a; 

    BOOST_REQUIRE( a.multiplyByTwo(2) == 5 );//<<---It shouldn't work 

}

It seems that doesn't matter what I type will it be 5, 4 or eight this test passes each time. What am I doing wrong?

A: 

Remove _tmain - it's not needed, and the test never executes if you have this there.

Verified on Win32 Visual Studio 2008, output is:

Running 1 test case...

c:/temp/test/test.cpp(25): fatal error in "my_test": critical check a.multiplyByTwo(2) == 5 failed

Steve Townsend