Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   CppUnit (http://www.go4expert.com/forums/cppunit-t20871/)

gregarion 4Feb2010 21:17

CppUnit
 
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


All times are GMT +5.5. The time now is 18:39.