예제 #1
0
int main(){
	int from []= {0,0,0,1,4};
	int to []= {1,3,4,2,5};
	int len []= {10,10,100,10,5};
	vector<int> f (from, from + sizeof(from)/sizeof(int));
	vector<int> t (to, to + sizeof(to)/sizeof(int));
	vector<int> l (len, len + sizeof(len)/sizeof(int));
	PowerOutage p;
	cout<< p.estimateTimeOut ( f,t,l)<< endl;
}
예제 #2
0
int main()
{
    int fromJ[]={0,0,0,1,4};
    int toJ[] = {1,3,4,2,5};
    int ductL[] = {10,10,5,10,100};
    vector<int> fromJunction (fromJ, fromJ+5);
    vector<int> toJunction (toJ, toJ+5);
    vector<int> ductLength(ductL, ductL+5);
    PowerOutage p;
    int dif = p.estimateTimeOut(fromJunction, toJunction, ductLength);
    return 0;
}
예제 #3
0
// BEGIN CUT HERE
int main(){
  PowerOutage test;
  int fromJunction[] = {0,0,0,1,4};
  int toJunction[] = {1,3,4,2,5};
  int ductLength[] = {10,10,100,10,5};
  vector<int> f,t,d;

  for(int i=0; i<5; i++){
    f.push_back(fromJunction[i]);
    t.push_back(toJunction[i]);
    d.push_back(ductLength[i]);
  }
  cout << test.estimateTimeOut(f, t, d) << endl;
}
예제 #4
0
파일: main.cpp 프로젝트: zhenl010/zhenl010
int main()
{
    int fjs[] =
    {0,1,0};
    int toJs[] = 
    {1,2,3};
    int ductLs[] =
    {10,10,10};

    vector <int> fromJunction(fjs, fjs+sizeof(fjs)/sizeof(int));
    vector <int> toJunction(toJs, toJs+sizeof(toJs)/sizeof(int));
    vector <int> ductLength(ductLs, ductLs+sizeof(ductLs)/sizeof(int));

    PowerOutage potage;
    int esTime = potage.estimateTimeOut(fromJunction, toJunction, ductLength);

    return 0;
}
예제 #5
0
bool do_test(vector<int> fromJunction, vector<int> toJunction, vector<int> ductLength, int __expected) {
    time_t startClock = clock();
    PowerOutage *instance = new PowerOutage();
    int __result = instance->estimateTimeOut(fromJunction, toJunction, ductLength);
    double elapsed = (double)(clock() - startClock) / CLOCKS_PER_SEC;
    delete instance;

    if (__result == __expected) {
        cout << "PASSED!" << " (" << elapsed << " seconds)" << endl;
        return true;
    }
    else {
        cout << "FAILED!" << " (" << elapsed << " seconds)" << endl;
        cout << "           Expected: " << to_string(__expected) << endl;
        cout << "           Received: " << to_string(__result) << endl;
        return false;
    }
}
예제 #6
0
    void testCase4() {
        int fromJunction_[] = {0, 0, 0, 0, 0};
        vector<int> fromJunction(fromJunction_, fromJunction_ + (sizeof(fromJunction_) / sizeof(fromJunction_[0])));
        int toJunction_[] = {1, 2, 3, 4, 5};
        vector<int> toJunction(toJunction_, toJunction_ + (sizeof(toJunction_) / sizeof(toJunction_[0])));
        int ductLength_[] = {100, 200, 300, 400, 500};
        vector<int> ductLength(ductLength_, ductLength_ + (sizeof(ductLength_) / sizeof(ductLength_[0])));
		int expected_ = 2500;
        assertEquals(4, expected_, solution.estimateTimeOut(fromJunction, toJunction, ductLength));
    }
예제 #7
0
    void testCase3() {
        int fromJunction_[] = {0, 0, 0, 1, 4, 4, 6, 7, 7, 7, 20};
        vector<int> fromJunction(fromJunction_, fromJunction_ + (sizeof(fromJunction_) / sizeof(fromJunction_[0])));
        int toJunction_[] = {1, 3, 4, 2, 5, 6, 7, 20, 9, 10, 31};
        vector<int> toJunction(toJunction_, toJunction_ + (sizeof(toJunction_) / sizeof(toJunction_[0])));
        int ductLength_[] = {10, 10, 100, 10, 5, 1, 1, 100, 1, 1, 5};
        vector<int> ductLength(ductLength_, ductLength_ + (sizeof(ductLength_) / sizeof(ductLength_[0])));
		int expected_ = 281;
        assertEquals(3, expected_, solution.estimateTimeOut(fromJunction, toJunction, ductLength));
    }
예제 #8
0
    void testCase2() {
        int fromJunction_[] = {0, 0, 0, 1, 4};
        vector<int> fromJunction(fromJunction_, fromJunction_ + (sizeof(fromJunction_) / sizeof(fromJunction_[0])));
        int toJunction_[] = {1, 3, 4, 2, 5};
        vector<int> toJunction(toJunction_, toJunction_ + (sizeof(toJunction_) / sizeof(toJunction_[0])));
        int ductLength_[] = {10, 10, 100, 10, 5};
        vector<int> ductLength(ductLength_, ductLength_ + (sizeof(ductLength_) / sizeof(ductLength_[0])));
		int expected_ = 165;
        assertEquals(2, expected_, solution.estimateTimeOut(fromJunction, toJunction, ductLength));
    }
예제 #9
0
    void testCase1() {
        int fromJunction_[] = {0, 1, 0};
        vector<int> fromJunction(fromJunction_, fromJunction_ + (sizeof(fromJunction_) / sizeof(fromJunction_[0])));
        int toJunction_[] = {1, 2, 3};
        vector<int> toJunction(toJunction_, toJunction_ + (sizeof(toJunction_) / sizeof(toJunction_[0])));
        int ductLength_[] = {10, 10, 10};
        vector<int> ductLength(ductLength_, ductLength_ + (sizeof(ductLength_) / sizeof(ductLength_[0])));
		int expected_ = 40;
        assertEquals(1, expected_, solution.estimateTimeOut(fromJunction, toJunction, ductLength));
    }
예제 #10
0
int main()
{
    PowerOutage so ;
    vector<int> fromJunction;
    fromJunction.push_back(0);
    fromJunction.push_back(0);
    fromJunction.push_back(0);
    fromJunction.push_back(1);
    fromJunction.push_back(4);
    fromJunction.push_back(4);
    fromJunction.push_back(6);
    fromJunction.push_back(7);
    fromJunction.push_back(7);
    fromJunction.push_back(7);
    fromJunction.push_back(20);
    vector<int> toJunction;
    toJunction.push_back(1);
    toJunction.push_back(3);
    toJunction.push_back(4);
    toJunction.push_back(2);
    toJunction.push_back(5);
    toJunction.push_back(6);
    toJunction.push_back(7);
    toJunction.push_back(20);
    toJunction.push_back(9);
    toJunction.push_back(10);
    toJunction.push_back(31);
    vector<int> ductLength;
    ductLength.push_back(10);
    ductLength.push_back(10);
    ductLength.push_back(100);
    ductLength.push_back(10);
    ductLength.push_back(5);
    ductLength.push_back(1);
    ductLength.push_back(1);
    ductLength.push_back(100);
    ductLength.push_back(1);
    ductLength.push_back(1);
    ductLength.push_back(5);
    int result = so.estimateTimeOut(fromJunction, toJunction, ductLength);
    cout<<result<<endl;
}