You are viewing a single comment's thread. Return to all comments →
C++ Solution:
namespace TestDataEmptyArray { vector<int> get_array() { vector<int> myArray = {}; return myArray; } } namespace TestDataUniqueValues { static vector<int> myArray; vector<int> get_array() { srand(time(NULL)); for(int i = 0; i < 2+rand()%10; i++) { myArray.push_back(i); } return myArray; } int get_expected_result() { return *std::min_element(myArray.begin(), myArray.end()); } } namespace TestDataExactlyTwoDifferentMinimums { static vector<int> myArray2 = {10,20,30,4,4,5,6,7}; vector<int> get_array() { return myArray2; } int get_expected_result() { return std::min_element(myArray2.begin(), myArray2.end()) - myArray2.begin(); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 27: Testing
You are viewing a single comment's thread. Return to all comments →
C++ Solution: