-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.cpp
83 lines (67 loc) · 1.94 KB
/
main.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* File: main.cpp
* Author: gadial
*
* Created on November 5, 2009, 10:44 AM
*/
#include <iostream>
#include "coordinates.h"
#include "ellipticcurve.h"
#include "curvesnist.h"
#include "primes.h"
#include "tests/curvesnisttest.h"
#include "tests/padictest.h"
#include "tests/bincurvetest.h"
#include "tests.h"
#include "adicops.h"
#include "elgamal.h"
#include "cmd.h"
#include "challange_crack.h"
//#include <NTL/GF2EX.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
int do_tests();
using namespace std;
void printCd(const Coordinate& c) {
cout << "(" << c.X << "," << c.Y << ")" << endl;
}
void printJac(const Jacobian& j) {
cout << "(" << j.X << "," << j.Y << "," << j.Z << ")" << endl;
}
/*
*
*/
int main(int argc, char** argv) {
//Adicops::do_s();
//Adicops::crack_challenge1();
Cmd* cmd = new Cmd(argc, argv);
if (cmd->do_tests) {
do_tests();
} else {
cmd->execute();
}
delete cmd;
return 0;
}
int do_tests(){
//CPPUNIT_TEST_SUITE_REGISTRATION(CurvesNISTTest);
CPPUNIT_TEST_SUITE_REGISTRATION(PrimesTest);
CPPUNIT_TEST_SUITE_REGISTRATION(EllipticCurveTest);
CPPUNIT_TEST_SUITE_REGISTRATION(PolynomialTest);
CPPUNIT_TEST_SUITE_REGISTRATION(ZpIntTest);
CPPUNIT_TEST_SUITE_REGISTRATION(Padictest);
CPPUNIT_TEST_SUITE_REGISTRATION(BinCurveTest);
// Get the top level suite from the registry
CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
// Adds the test to the list of test to run
CppUnit::TextUi::TestRunner runner;
runner.addTest( suite );
// Change the default outputter to a compiler error format outputter
runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
std::cerr ) );
// Run the tests.
bool wasSucessful = runner.run();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}