Exemplo n.º 1
0
int main(int argc, const char * argv[]) {
    
    CorporationSalary corporationSalary;
    vector <string> relations = {
        "N"
    };
    
    long total = corporationSalary.totalSalary(relations);
    cout<< "0) salary: " << total << endl;
    
    
    relations = {
        "NNYN",
        "NNYN",
        "NNNN",
        "NYYN"
    };
    total = corporationSalary.totalSalary(relations);
    cout<< "1) salary: " << total << endl;
    
    
    relations = {
        "NNNNNN",
        "YNYNNY",
        "YNNNNY",
        "NNNNNN",
        "YNYNNN",
        "YNNYNN"
    };
    total = corporationSalary.totalSalary(relations);
    cout<< "2) salary: " << total << endl;
    
    
    relations = {
        "NYNNYN",
        "NNNNNN",
        "NNNNNN",
        "NNYNNN",
        "NNNNNN",
        "NNNYYN"
    };
    total = corporationSalary.totalSalary(relations);
    cout<< "3) salary: " << total << endl;
    
    relations = {
        "NNNN",
        "NNNN",
        "NNNN",
        "NNNN"
      
    };
    total = corporationSalary.totalSalary(relations);
    cout<< "4) salary: " << total << endl;
    
    return 0;
}
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, vector <string> p0, bool hasAnswer, long long p1) {
	cout << "Test " << testNum << ": [" << "{";
	for (int i = 0; int(p0.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << "\"" << p0[i] << "\"";
	}
	cout << "}";
	cout << "]" << endl;
	CorporationSalary *obj;
	long long answer;
	obj = new CorporationSalary();
	clock_t startTime = clock();
	answer = obj->totalSalary(p0);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << p1 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p1;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
Exemplo n.º 3
0
    void testCase4() {
        string relations_[] = {"NNNN", "NNNN", "NNNN", "NNNN"};
        vector<string> relations(relations_, relations_ + (sizeof(relations_) / sizeof(relations_[0])));
		long long expected_ = 4LL;
        assertEquals(4, expected_, solution.totalSalary(relations));
    }