1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CppUnit

Discussion in 'C++' 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...

    Code:
     
     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    void 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...


    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    #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
     

Share This Page