added: some tests for Big<> and Parser<> classes (tests2 directory)
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@1225 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
39
tests2/main.cpp
Normal file
39
tests2/main.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <ttmath/ttmath.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
typedef ttmath::Big<TTMATH_BITS(TTMATH_TEST_BIG_EXPONENT), TTMATH_BITS(TTMATH_TEST_BIG_MANTISSA)> MyBig;
|
||||
ttmath::Parser<MyBig> parser;
|
||||
std::string all_input;
|
||||
|
||||
for(int i=1 ; i<argc ; ++i)
|
||||
{
|
||||
if( i > 1 )
|
||||
all_input += ' ';
|
||||
|
||||
all_input += argv[i];
|
||||
}
|
||||
|
||||
std::cout << all_input << " = ";
|
||||
ttmath::ErrorCode err = parser.Parse(all_input);
|
||||
|
||||
if( err == ttmath::err_ok )
|
||||
{
|
||||
for(size_t i=0 ; i < parser.stack.size() ; ++i)
|
||||
{
|
||||
if( i > 0 )
|
||||
std::cout << " ; ";
|
||||
|
||||
std::cout << parser.stack[i].value;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "error: " << static_cast<int>(err) << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user