-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildTestCases.cpp
72 lines (55 loc) · 1.31 KB
/
buildTestCases.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
#include <iostream>
#include <vector>
#include <string>
#include <limits>
using namespace std;
class testStruct{
public:
char name;
vector<char> memberVars;
};
testStruct buildStruct(testStruct *structure){
char selection;
cin >> selection;
switch(selection){
case 'n':
char varname;
cout << "\nplease input a name for this var: ";
cin >> varname;
cin.ignore(1,'\n');
structure -> memberVars.push_back(varname);
break;
case 'l':
for (int i = 0;
i < static_cast<int>(structure -> memberVars.size()); ++i)
{
cout << "\n" << structure -> memberVars.at(i);
}
break;
case 's':
return *structure;
default:
cout << "\ncommand not recognised\n";
break;
}
return *structure;
}
testStruct declareStruct(){
testStruct *structure = new testStruct();
char selection;
char structname;
cout << "\ndefine test struct\n";
cout << "please enter a name for this struct: ";
cin >> structname;
cin.ignore(numeric_limits<streamsize>::max(),'\n');
structure -> name = structname;
cout << "\ntype 'n' to add new var\n";
cout << "type 'l to list added vars'\n";
cout << "type 's' to save test struct\n";
buildStruct(structure);
}
int main(int argc, char* argv[]){
cout << "\nTest case expression builder for verilator custom testbench\n\n";
declareStruct();
return 0;
}