|
Revision 1, 1.1 kB
(checked in by pantley2, 4 years ago)
|
GGPA code from the good old days of SIGART
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
#include "VariableAssignmentIterator.h" |
|---|
| 5 |
#include "TestTools.h" |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
void testIterator() { |
|---|
| 12 |
cout << "Starting VariableAssignmentIterator test... " << endl; |
|---|
| 13 |
map<string, vector<string> > variableMap; |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
variableMap["%x"].push_back("1"); |
|---|
| 17 |
variableMap["%x"].push_back("2"); |
|---|
| 18 |
variableMap["%x"].push_back("3"); |
|---|
| 19 |
|
|---|
| 20 |
variableMap["%y"].push_back("1"); |
|---|
| 21 |
variableMap["%y"].push_back("2"); |
|---|
| 22 |
variableMap["%y"].push_back("3"); |
|---|
| 23 |
|
|---|
| 24 |
variableMap["%z"].push_back("x"); |
|---|
| 25 |
variableMap["%z"].push_back("o"); |
|---|
| 26 |
variableMap["%z"].push_back("b"); |
|---|
| 27 |
|
|---|
| 28 |
VariableAssignmentIterator itr(variableMap); |
|---|
| 29 |
int count = 0; |
|---|
| 30 |
for (; !itr.atEnd(); itr.next()) { |
|---|
| 31 |
map<string, string> assignment = itr.getCurrent(); |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
count++; |
|---|
| 35 |
} |
|---|
| 36 |
assertEquals(27, count, "Number of instances is incorrect"); |
|---|
| 37 |
cout << "done." << endl; |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
int main() { |
|---|
| 45 |
testIterator(); |
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
return 0; |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|