CppUnit testing

Discussion in 'Programming' started by gregarion, Feb 4, 2010.

  1. gregarion

    gregarion New Member

    Joined:
    Feb 4, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Hey guys, i am trying to test one of my classes using cppunit.

    the class is suppose to extract data out of a certain text file and then displays it...

    v Code:
    oid readNasdaq::Nasdaq(fstream& myfile)
    {
    string templine ;
    string line;

    while (getline (myfile,templine) )
    {
    line.append(templine);
    }

    int NasdaqValueID = line.find ("id=\"yfs_l10_^ixic\">" , 0) ;
    int NasdaqValueCount = line.find ("</span></td><td class=\"ticker_down\"><span class=\"streaming-datum\" id=\"yfs_c10_^ixic\">" , 0) ;

    int LocationNasdaqValue = NasdaqValueID + 19 ;
    int LengthOfNasdaqValue = NasdaqValueCount - LocationNasdaqValue ;

    string NasdaqValue = line.substr( LocationNasdaqValue , LengthOfNasdaqValue ) ;

    cout << " " << endl ;
    cout << "The Value Index of Nasdaq is " << NasdaqValue << endl ;


    int NasdaqValueChangeID = line.find ("id=\"yfs_c10_^ixic\">" , 0 ) ;
    int NasdaqValueChangeCount = line.find ("</span></td><td class=\"right_cell ticker_down\"><span class=\"streaming-datum\" id=\"yfs_pp0_^ixic\">" , 0) ;

    int LocationNasdaqValueChange = NasdaqValueChangeID + 19 ;
    int LengthOfNasdaqValueChange = NasdaqValueChangeCount - LocationNasdaqValueChange ;

    string NasdaqValueChange = line.substr (LocationNasdaqValueChange , LengthOfNasdaqValueChange ) ;

    cout << "The Value Change for Nasdaq is " << NasdaqValueChange << endl ;
    the problem i have with my cppunit is how am i suppose to read the value being outputted and test it...

    Code:
    #include "financetest.h"
    #include "finance.h"



    CPPUNIT_TEST_SUITE_REGISTRATION (FinanceTest);



    void FinanceTest::setUp()
    {
    New = " ";
    NewValue = " " ;


    }

    void FinanceTest::tearDown()
    {

    }

    void FinanceTest::testEquals()
    {

    }

    How can i continue from here.. really need some help from this
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice