Unit Testing Frameworks
-
Tim Smith wrote:
He's joking.
Are you sure? It's espeir. If anybody else had said this I would agree to you. :~ ------------------------------ PROST Roleplaying Game
He's poking fun at those Plain English guys. But it's nice to know how you feel about espeir now. ;)
They dress you up in white satin, And give you your very own pair of wings In August and Everything After
I'm after everything
-
Which unit testing framework (if any) do you use for C++ applications? CXXTest, cppunit, VS 2005, any other? Muhammad Shoaib Khan http://geocities.com/lansolution
My Unit Test Framework:
#include <assert.h>
(actually I'm using _ASSERTE / ATLASSERT, but it's the spirit that counts) :cool: sample usage:
void CheckTrans(CLangTranslator & trans, LPCTSTR in, LPCTSTR out)
{
CString s(in);
trans.Translate(s);
assert(s == out);
}void Test_Translator()
{
// ... setup// simple replacement
CheckTrans(trans, "{Head1}", "Ihre Werte bitte");// replacement with surrounding text
CheckTrans(trans, "|-- {Head1} --|", "|-- Ihre Werte bitte --|");// partial prefix
CheckTrans(trans, "{Head1{Head1}", "{Head1Ihre Werte bitte" );// multiple replacements, args expected, none provided
CheckTrans(trans,
"|-- {head1} --|| {value1} |",
"|-- Ihre Werte bitte --|| Explosion: {1}..{2} Hz |");// two arguments expected, two given:
CheckTrans(trans, "{value1:10;20}", "Explosion: 10..20 Hz" );// two arguments expected, one given:
CheckTrans(trans, "{value1:10}", "Explosion: 10..{2} Hz" );// two arguments expected, three given:
CheckTrans(trans, "{value1:10;20;30}", "Explosion: 10..20 Hz" );// ...teardown
}int main()
{
Test_Translator();
}Start it under the debugger. If the assert fires, you can go immediately to the point of failure, examine values etc. It's fun, it's simple, it makes sense.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree in C# || Fold With Us! || sighist -
He's poking fun at those Plain English guys. But it's nice to know how you feel about espeir now. ;)
They dress you up in white satin, And give you your very own pair of wings In August and Everything After
I'm after everything
espeir does irony but he never jokes. Above was sarcasm however. regards, Paul Watson Ireland Feed Henry! K(arl) wrote: oh, and BTW, CHRISTIAN ISN'T A PARADOX, HE IS A TASMANIAN!
adapted from toxcct:
while (!enough)
sprintf 0 || 1
do -
espeir does irony but he never jokes. Above was sarcasm however. regards, Paul Watson Ireland Feed Henry! K(arl) wrote: oh, and BTW, CHRISTIAN ISN'T A PARADOX, HE IS A TASMANIAN!
adapted from toxcct:
while (!enough)
sprintf 0 || 1
doPaul Watson wrote:
espeir does irony but he never jokes. Above was sarcasm however.
The man's behavior has been thoroughly analyzed, eh? Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
The Ultimate Grid - The #1 MFC grid out there! -
Paul Watson wrote:
espeir does irony but he never jokes. Above was sarcasm however.
The man's behavior has been thoroughly analyzed, eh? Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
The Ultimate Grid - The #1 MFC grid out there!That man is correct. I do not joke...Ever. :((
-
Paul Watson wrote:
espeir does irony but he never jokes. Above was sarcasm however.
The man's behavior has been thoroughly analyzed, eh? Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
The Ultimate Grid - The #1 MFC grid out there!He ingratiated himself with me over my Vole post. regards, Paul Watson Ireland Feed Henry! K(arl) wrote: oh, and BTW, CHRISTIAN ISN'T A PARADOX, HE IS A TASMANIAN!
adapted from toxcct:
while (!enough)
sprintf 0 || 1
do -
Paul Watson wrote:
espeir does irony but he never jokes. Above was sarcasm however.
The man's behavior has been thoroughly analyzed, eh? Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
The Ultimate Grid - The #1 MFC grid out there!Nishant Sivakumar wrote:
The man's behavior has been thoroughly analyzed, eh?
Picking up a Canadian accent? ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
-
Nishant Sivakumar wrote:
The man's behavior has been thoroughly analyzed, eh?
Picking up a Canadian accent? ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
Colin Angus Mackay wrote:
Picking up a Canadian accent?
Only in my writing :) Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
The Ultimate Grid - The #1 MFC grid out there! -
In general, Boost.Test library, although mostly I usually write just a bunch of asserts without any framework.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
ASSERT is Evil. Repeat ten times.
-
My Unit Test Framework:
#include <assert.h>
(actually I'm using _ASSERTE / ATLASSERT, but it's the spirit that counts) :cool: sample usage:
void CheckTrans(CLangTranslator & trans, LPCTSTR in, LPCTSTR out)
{
CString s(in);
trans.Translate(s);
assert(s == out);
}void Test_Translator()
{
// ... setup// simple replacement
CheckTrans(trans, "{Head1}", "Ihre Werte bitte");// replacement with surrounding text
CheckTrans(trans, "|-- {Head1} --|", "|-- Ihre Werte bitte --|");// partial prefix
CheckTrans(trans, "{Head1{Head1}", "{Head1Ihre Werte bitte" );// multiple replacements, args expected, none provided
CheckTrans(trans,
"|-- {head1} --|| {value1} |",
"|-- Ihre Werte bitte --|| Explosion: {1}..{2} Hz |");// two arguments expected, two given:
CheckTrans(trans, "{value1:10;20}", "Explosion: 10..20 Hz" );// two arguments expected, one given:
CheckTrans(trans, "{value1:10}", "Explosion: 10..{2} Hz" );// two arguments expected, three given:
CheckTrans(trans, "{value1:10;20;30}", "Explosion: 10..20 Hz" );// ...teardown
}int main()
{
Test_Translator();
}Start it under the debugger. If the assert fires, you can go immediately to the point of failure, examine values etc. It's fun, it's simple, it makes sense.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree in C# || Fold With Us! || sighistASSERT is Evil. Repeat 1000 times.
-
ASSERT is Evil. Repeat 1000 times.
-
ASSERT is Evil. Repeat 1000 times.
Assert is perfect for many things, but not for all. Again: why evil?
Some of us walk the memory lane, others plummet into a rabbit hole
Tree in C# || Fold With Us! || sighist