
"Tan Zhi"
According to the document, BOOST_CHECK is the same as BOST_CHECK_EQUAL. However,I found an exception. Which is listed below, where m_mmf.SetLngGetString(1033, 1) returns a const wchar_t* type.
Interestingly, the first two tests fail, while the last two pass.
BOOST_CHECK(L"A" == m_mmf.SetLngGetString(1033, 1));
BOOST_CHECK(m_mmf.SetLngGetString(1033, 1) == L"A" );
This actually perform pointers comparizons and almost never produce true.
BOOST_CHECK_EQUAL(L"A", m_mmf.SetLngGetString(1033, 1));
BOOST_CHECK_EQUAL(m_mmf.SetLngGetString(1033, 1), L"A");
Boost.Test includes special treatement to C strings comparisons. As a result actual value are compared not the pointers. That's another reason to prefer BOOST_CHECK_EQUAL to BOOST_CHECK. Gennadiy
Can any one please help to explain it? Thanks