source: trunk/IPs/systemC/processor/Morpheo/Include/Test.h @ 3

Last change on this file since 3 was 3, checked in by kane, 17 years ago

1) Ajout d'un "printer" XML pour la configuration de paramètres

2) Fin du composant "Two_Level_Branch_Predictor"

validation * systemc

  • vhdl
File size: 1016 bytes
Line 
1#ifndef TEST_H
2#define TEST_H
3
4#include <iostream>
5#include <sstream>
6#include <stdint.h>
7#include "Include/ErrorMorpheo.h"
8using namespace std;
9
10//-----[ Routine de test ]---------------------------------------
11
12static uint32_t num_test;
13
14template <class T>
15void test_ko (T exp1, T exp2, char * file, uint32_t line)
16{
17  string msg = ("{"+toString(num_test)+"} : Test KO\n" +
18                " * Localisation\n"                    +
19                "   - File : "+file+"\n"               +
20                "   - Line : "+toString(line)+"\n"     +
21                " * Expression is different\n"         +
22                "   - exp1 : "+toString(exp1)+"\n"     +
23                "   - exp2 : "+toString(exp2)+"\n");
24 
25  throw (ErrorMorpheo (msg));
26};
27
28void test_ok ()
29{
30  cout << "{" << num_test << "} : Test OK" << endl;
31
32  num_test ++;
33};
34
35template <class T>
36void test(T exp1, T exp2, char * file, uint32_t line)
37{
38  if (exp1 != exp2)
39    test_ko <T> (exp1,exp2,file,line);
40  else
41    test_ok     ();
42};
43
44#define TEST(type,exp1,exp2) do { test<type> (exp1,exp2,__FILE__,__LINE__);} while(0)
45
46#endif
Note: See TracBrowser for help on using the repository browser.