Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Unit Testing Frameworks

Unit Testing Frameworks

Scheduled Pinned Locked Moved The Lounge
c++visual-studiocomtestingbeta-testing
19 Posts 13 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abc876
    wrote on last edited by
    #1

    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

    R R N P 4 Replies Last reply
    0
    • A abc876

      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

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      We use cppunit at work. It's good because we also have code in Ruby and Perl, and there are clones available for both, making coding more consistent between the two.

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      1 Reply Last reply
      0
      • A abc876

        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

        R Offline
        R Offline
        Red Stateler
        wrote on last edited by
        #3

        If you have to test your code, then there is something SERIOUSLY WRONG! Code should be written using NATURAL SPEECH so that you KNOW when something DOESN'T MAKE SENSE when you read it.

        I 1 Reply Last reply
        0
        • R Red Stateler

          If you have to test your code, then there is something SERIOUSLY WRONG! Code should be written using NATURAL SPEECH so that you KNOW when something DOESN'T MAKE SENSE when you read it.

          I Offline
          I Offline
          Ingo
          wrote on last edited by
          #4

          You never had a problem with a pointer in C++? Well then you have never programmed C++, I think. It's normal when you have typed a wrong char in a huge code. Nobody is perfect. Greetings, Ingo ------------------------------ PROST Roleplaying Game

          T 1 Reply Last reply
          0
          • A abc876

            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

            N Offline
            N Offline
            Nemanja Trifunovic
            wrote on last edited by
            #5

            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.

            T 1 Reply Last reply
            0
            • I Ingo

              You never had a problem with a pointer in C++? Well then you have never programmed C++, I think. It's normal when you have typed a wrong char in a huge code. Nobody is perfect. Greetings, Ingo ------------------------------ PROST Roleplaying Game

              T Offline
              T Offline
              Tim Smith
              wrote on last edited by
              #6

              He's joking. Tim Smith I'm going to patent thought. I have yet to see any prior art.

              I 1 Reply Last reply
              0
              • T Tim Smith

                He's joking. Tim Smith I'm going to patent thought. I have yet to see any prior art.

                I Offline
                I Offline
                Ingo
                wrote on last edited by
                #7

                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

                D 1 Reply Last reply
                0
                • I Ingo

                  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

                  D Offline
                  D Offline
                  David Stone
                  wrote on last edited by
                  #8

                  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

                  P 1 Reply Last reply
                  0
                  • A abc876

                    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

                    P Offline
                    P Offline
                    peterchen
                    wrote on last edited by
                    #9

                    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

                    T 1 Reply Last reply
                    0
                    • D David Stone

                      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

                      P Offline
                      P Offline
                      Paul Watson
                      wrote on last edited by
                      #10

                      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

                      N 1 Reply Last reply
                      0
                      • P Paul Watson

                        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

                        N Offline
                        N Offline
                        Nish Nishant
                        wrote on last edited by
                        #11

                        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!

                        R P C 3 Replies Last reply
                        0
                        • N Nish Nishant

                          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!

                          R Offline
                          R Offline
                          Red Stateler
                          wrote on last edited by
                          #12

                          That man is correct. I do not joke...Ever. :((

                          1 Reply Last reply
                          0
                          • N Nish Nishant

                            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!

                            P Offline
                            P Offline
                            Paul Watson
                            wrote on last edited by
                            #13

                            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

                            1 Reply Last reply
                            0
                            • N Nish Nishant

                              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!

                              C Offline
                              C Offline
                              Colin Angus Mackay
                              wrote on last edited by
                              #14

                              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?

                              N 1 Reply Last reply
                              0
                              • C Colin Angus Mackay

                                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?

                                N Offline
                                N Offline
                                Nish Nishant
                                wrote on last edited by
                                #15

                                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!

                                1 Reply Last reply
                                0
                                • N Nemanja Trifunovic

                                  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.

                                  T Offline
                                  T Offline
                                  TheGreatAndPowerfulOz
                                  wrote on last edited by
                                  #16

                                  ASSERT is Evil. Repeat ten times.

                                  1 Reply Last reply
                                  0
                                  • P peterchen

                                    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

                                    T Offline
                                    T Offline
                                    TheGreatAndPowerfulOz
                                    wrote on last edited by
                                    #17

                                    ASSERT is Evil. Repeat 1000 times.

                                    S P 2 Replies Last reply
                                    0
                                    • T TheGreatAndPowerfulOz

                                      ASSERT is Evil. Repeat 1000 times.

                                      S Offline
                                      S Offline
                                      Shog9 0
                                      wrote on last edited by
                                      #18

                                      Why? Explain once. ----

                                      Bots don't know when people die. --Paul Watson, RIP

                                      1 Reply Last reply
                                      0
                                      • T TheGreatAndPowerfulOz

                                        ASSERT is Evil. Repeat 1000 times.

                                        P Offline
                                        P Offline
                                        peterchen
                                        wrote on last edited by
                                        #19

                                        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

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • World
                                        • Users
                                        • Groups