Figure 3: The run member function of BaseTest32
template<typename I1, typename I2, typename I3, typename O1, typename O2> bool BaseTest32<I1, I2, I3, O1, O2>::run(int first, int last, std::fstream &fout) { O1 tempo1; O2 tempo2; // constrain range, if necessary if(first < 0) first = 0; if(last > i1s.size() - 1) last = i1s.size() - 1; for(int i = first; i <= last; ++i) { // call polymorphically apply(i1s[i], i2s[i], i3s[i], tempo1, tempo2); if((tempo1 == o1s[i]) && (tempo2 == o2s[i])) fout << getName() << "(" << i << ") successful. Output: " << tempo1 << ", " << tempo2 << std::endl; else { fout << getName() << "(" << i << ") UNSUCCESSFUL" << std::endl; fout << " expected: " << o1s[i] << ", actual: " << tempo1 << std::endl; fout << " expected: " << o2s[i] << ", actual: " << tempo2 << std::endl; return false; } } return true; }