Ajout des cas de tests pour les TP non-graphiques. Cleanage en tous genres.
[GPU.git] / WCudaMSE / Student_Cuda / src / cpp / test / mainTest.cpp
1 #include <stdlib.h>
2 #include <iostream>
3 #include <string>
4
5 #include "cppTest+.h"
6 #include "Device.h"
7 #include "StringTools.h"
8 #include "cudaTools.h"
9
10 #include "TestHello.h"
11 #include "TestSaucisson.h"
12 #include "TestProduitScalaire.h"
13 #include "TestHistogramme.h"
14 #include "TestMonteCarlo.h"
15
16 using std::string;
17 using std::cout;
18 using std::endl;
19
20 using Test::Suite;
21
22 /*----------------------------------------------------------------------*\
23 |* Declaration *|
24 \*---------------------------------------------------------------------*/
25
26 /*--------------------------------------*\
27 |* Imported *|
28 \*-------------------------------------*/
29
30 /*--------------------------------------*\
31 |* Private *|
32 \*-------------------------------------*/
33
34 static bool testALL();
35
36 /*--------------------------------------*\
37 |* Public *|
38 \*-------------------------------------*/
39
40 int mainTest();
41
42 /*----------------------------------------------------------------------*\
43 |* Implementation *|
44 \*---------------------------------------------------------------------*/
45
46 /*--------------------------------------*\
47 |* Public *|
48 \*-------------------------------------*/
49
50 int mainTest()
51 {
52 bool isOk = testALL();
53
54 cout << "\nisOK = " << isOk << endl;
55
56 return isOk ? EXIT_SUCCESS : EXIT_FAILURE;
57 }
58
59 /*--------------------------------------*\
60 |* Private *|
61 \*-------------------------------------*/
62
63 bool testALL()
64 {
65 int deviceId = Device::getDeviceId();
66
67 Suite testSuite;
68
69 testSuite.add(std::auto_ptr<Suite>(new TestHello(deviceId)));
70 testSuite.add(std::auto_ptr<Suite>(new TestSaucisson(deviceId)));
71 testSuite.add(std::auto_ptr<Suite>(new TestProduitScalaire(deviceId)));
72 testSuite.add(std::auto_ptr<Suite>(new TestHistogramme(deviceId)));
73 testSuite.add(std::auto_ptr<Suite>(new TestMonteCarlo(deviceId)));
74
75 string titre = "deviceId_" + StringTools::toString(deviceId);
76
77 return runTestHtml(titre, testSuite); // Attention: html create in working directory!!
78 //return runTestConsole(titre, testSuite);
79 }
80
81 /*----------------------------------------------------------------------*\
82 |* End *|
83 \*---------------------------------------------------------------------*/
84