Sponsored Content
Full Discussion: CppUnit
Top Forums Programming CppUnit Post 302392374 by gregarion on Thursday 4th of February 2010 08:13:17 AM
Old 02-04-2010
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...

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()
{
    
    }

This is how far i got. Can anybody give me some clue on how to continue.
 

We Also Found This Discussion For You

1. Programming

Understanding cppUnit.

Hey guys, i am doing a project which has to incorporate some unit testing using cPPUnit. i am unable to actually find some proper tutorials which is good for a beginner like me. Could you guys help in giving me some tutorials,examples or links where i am able to understand how is it being used? (1 Reply)
Discussion started by: gregarion
1 Replies
PASTE(1)						    BSD General Commands Manual 						  PASTE(1)

NAME
paste -- merge corresponding or subsequent lines of files SYNOPSIS
paste [-s] [-d list] file ... DESCRIPTION
The paste utility concatenates the corresponding lines of the given input files, replacing all but the last file's newline characters with a single tab character, and writes the resulting lines to standard output. If end-of-file is reached on an input file while other input files still contain data, the file is treated as if it were an endless source of empty lines. The options are as follows: -d list Use one or more of the provided characters to replace the newline characters instead of the default tab. The characters in list are used circularly, i.e., when list is exhausted the first character from list is reused. This continues until a line from the last input file (in default operation) or the last line in each file (using the -s option) is displayed, at which time paste begins selecting characters from the beginning of list again. The following special characters can also be used in list: newline character tab character \ backslash character Empty string (not a null character). Any other character preceded by a backslash is equivalent to the character itself. -s Concatenate all of the lines of each separate input file in command line order. The newline character of every line except the last line in each input file is replaced with the tab character, unless otherwise specified by the -d option. If '-' is specified for one or more of the input files, the standard input is used; standard input is read one line at a time, circularly, for each instance of '-'. EXAMPLES
List the files in the current directory in three columns: ls | paste - - - Combine pairs of lines from a file into single lines: paste -s -d ' ' myfile Number the lines in a file, similar to nl(1): sed = myfile | paste -s -d ' ' - - Create a colon-separated list of directories named bin, suitable for use in the PATH environment variable: find / -name bin -type d | paste -s -d : - DIAGNOSTICS
The paste utility exits 0 on success, and >0 if an error occurs. SEE ALSO
cut(1), lam(1) STANDARDS
The paste utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible. HISTORY
A paste command appeared in Version 32V AT&T UNIX. BUGS
Multibyte character delimiters cannot be specified with the -d option. BSD
September 20, 2001 BSD
All times are GMT -4. The time now is 09:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy