Library 1

Professor fixed his tests.
This commit is contained in:
Alessandro Ferro 2021-04-10 10:11:59 +02:00
parent 9b9dcdec17
commit fef5b8ae75
3 changed files with 18 additions and 12 deletions

Binary file not shown.

View File

@ -26,8 +26,8 @@ void GetFront(uint& testnum, uint& testerr, const lasd::LinearContainer<Data>& c
} catch(std::length_error exc) {
std::cout << exc.what() << "\": " << ((tst = !chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::exception exc) {
tst = true;
std::cout << std::endl << "Wrong std::exception: " << exc.what() << "!" << std::endl;
tst = false;
std::cout << std::endl << "Wrong exception: " << exc.what() << "!" << std::endl;
}
testerr += (1 - (uint) tst);
}
@ -43,8 +43,8 @@ void SetFront(uint& testnum, uint& testerr, const lasd::LinearContainer<Data>& c
} catch(std::length_error exc) {
std::cout << exc.what() << "\": " << ((tst = !chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::exception exc) {
tst = true;
std::cout << std::endl << "Wrong std::exception: " << exc.what() << "!" << std::endl;
tst = false;
std::cout << std::endl << "Wrong exception: " << exc.what() << "!" << std::endl;
}
testerr += (1 - (uint) tst);
}
@ -59,8 +59,8 @@ void GetBack(uint& testnum, uint& testerr, const lasd::LinearContainer<Data>& co
} catch(std::length_error exc) {
std::cout << exc.what() << "\": " << ((tst = !chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::exception exc) {
tst = true;
std::cout << std::endl << "Wrong std::exception: " << exc.what() << "!" << std::endl;
tst = false;
std::cout << std::endl << "Wrong exception: " << exc.what() << "!" << std::endl;
}
testerr += (1 - (uint) tst);
}
@ -76,8 +76,8 @@ void SetBack(uint& testnum, uint& testerr, const lasd::LinearContainer<Data>& co
} catch(std::length_error exc) {
std::cout << exc.what() << "\": " << ((tst = !chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::exception exc) {
tst = true;
std::cout << std::endl << "Wrong std::exception: " << exc.what() << "!" << std::endl;
tst = false;
std::cout << std::endl << "Wrong exception: " << exc.what() << "!" << std::endl;
}
testerr += (1 - (uint) tst);
}
@ -93,8 +93,8 @@ void SetAt(uint& testnum, uint& testerr, lasd::LinearContainer<Data>& con, bool
} catch(std::out_of_range exc) {
std::cout << "\"" << exc.what() << "\": " << ((tst = !chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::exception exc) {
tst = true;
std::cout << std::endl << "Wrong std::exception: " << exc.what() << "!" << std::endl;
tst = false;
std::cout << std::endl << "Wrong exception: " << exc.what() << "!" << std::endl;
}
testerr += (1 - (uint) tst);
}
@ -109,8 +109,8 @@ void GetAt(uint& testnum, uint& testerr, lasd::LinearContainer<Data>& con, bool
} catch(std::out_of_range exc) {
std::cout << exc.what() << "\": " << ((tst = !chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::exception exc) {
tst = true;
std::cout << std::endl << "Wrong std::exception: " << exc.what() << "!" << std::endl;
tst = false;
std::cout << std::endl << "Wrong exception: " << exc.what() << "!" << std::endl;
}
testerr += (1 - (uint) tst);
}

View File

@ -30,6 +30,9 @@ void RemoveFromFront(uint& testnum, uint& testerr, lasd::List<Data>& lst, bool c
std::cout << ((tst = chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::length_error exc) {
std::cout << exc.what() << "\": " << ((tst = !chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::exception exc) {
tst = false;
std::cout << std::endl << "Wrong exception: " << exc.what() << "!" << std::endl;
}
testerr += (1 - (uint) tst);
}
@ -43,6 +46,9 @@ void FrontNRemove(uint& testnum, uint& testerr, lasd::List<Data>& lst, bool chk,
std::cout << ((tst = ((lst.FrontNRemove() == val) == chk)) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::length_error exc) {
std::cout << exc.what() << "\": " << ((tst = !chk) ? "Correct" : "Error") << "!" << std::endl;
} catch(std::exception exc) {
tst = false;
std::cout << std::endl << "Wrong exception: " << exc.what() << "!" << std::endl;
}
testerr += (1 - (uint) tst);
}