1
Vote

WIN_ASSERT_TRUE only expects strings

description

This macro only expects strings. However other unit testing frameworks have this macro for numeric values. Currently if I pass in numeric values to this I get build errors. I want to compile at warning level 4, and this macro is getting in the way of that.
 
So for instance, I want to be able to do this:
 
WIN_ASSERT_EQUAL( 1, foo->GetNum() );

comments

Jhualpa wrote Oct 19, 2009 at 5:24 AM

Chis, your issue seems confusing. WIN_ASSERT_TRUE only expects a condition that evaluates to true or false, and WIN_ASSERT_EQUAL accepts both numeric values and strings as well. Try this sample tests I have developed, I did compiled them with warning level 4 and no issues.

#include "WinUnit.h"
#include "string.h"

BEGIN_TEST(WIN_ASSERT_TRUE_With_Numbers)
{
WIN_ASSERT_TRUE(4 == 4);
}
END_TEST

BEGIN_TEST(WIN_ASSERT_TRUE_With_Strings)
{
WIN_ASSERT_TRUE(strcmp("4","4")==0);
}
END_TEST

BEGIN_TEST(WIN_ASSERT_EQUAL_With_Numbers)
{
WIN_ASSERT_EQUAL(4, 4);
}
END_TEST

BEGIN_TEST(WIN_ASSERT_EQUAL_With_Strings)
{
WIN_ASSERT_EQUAL("4","4");
}
END_TEST

wrote Feb 14, 2013 at 7:21 PM