mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-10 22:27:08 +01:00
Running one directory (EADS) had already produced four bugs, so all of them
were run. 11 failed. Every one was real -- either in the coursework or in the
harness I had just written -- and the split was roughly even.
Coursework bugs:
- 15 .tex files use Polish ogonek characters with no fontenc, so pdflatex
dies with "Command \k unavailable in encoding OT1". Fixed where it was
actually needed, not blanket-applied.
- BSS had \documentclass{article}[12pt] -- options after the class name,
where they are not options at all.
- SDM's beamer deck had a stray } on an \item, which took out the frame.
- EOOP/Various/currency included "currency2.hpp"; the file is currency.hpp.
- ECRYPT_PROJECT had the SAME stdlib-shadowing bug as ECOTE: a package named
code/. Renamed to sieve/, and its 99 tests now run. With ECOTE's 26 that
is 125 tests that could not execute at all before today.
Harness bugs, which the run is what exposed:
- COURSE_ENTRY pointed at directories for PORR and ECRYPT_PROJECT, so python
looked for __main__.py and reported the wrong problem.
- main.py was auto-picked via find's first result. EARIN has six labs and
six main.py files, so that ran an arbitrary lab and called it the course.
Now only auto-picked when exactly one exists.
- Only the first requirements.txt was installed, which is why EARIN still
died on gymnasium after a venv was created for it. All of them now.
- The notebook probe accepted jupyter being on PATH. This machine's jupyter
is a pipx shim whose interpreter is gone, so "runnable" was a lie; it now
invokes jupyter --version and PBAD/twm_4 report blocked, honestly.
- Nothing ran a course's tests. Where a suite exists it is now the check,
which matters most for ECRYPT_PROJECT, whose program prompts on stdin and
cannot be run headlessly at all.
- Which directory pytest runs from is course-specific and unguessable, so
stubs pass --test-dir: ECOTE needs program/ for imports, ECRYPT_PROJECT
needs sieve/ because its fixtures open a CSV by relative path.
gates/known-incomplete.txt records the one file that genuinely cannot build:
EOOP/Various/set/set.cpp includes set.hpp, which `git log --all` shows has
never existed here. The course supplied it and only the .cpp was submitted.
That is a factual record with a stated check, not a lint allowlist -- and
fabricating the header would be inventing coursework.
Status is now 36 runnable / 5 no-code / 3 blocked.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
95 lines
2.8 KiB
C++
Executable File
95 lines
2.8 KiB
C++
Executable File
/**
|
|
Unit tests for 2nd EOOP assignment.
|
|
|
|
Currency - aggregate 2 doubles (monetary value, exchange rate to dollars)
|
|
CurrencyView - view the given currency with different exchange rate
|
|
(e.g. view PLN value in GBP), store the reference to the Currency.
|
|
|
|
Note that this is in a big part "code reading" exercise.
|
|
Based on this file you should implement two classes mentioned above,
|
|
with proper interface, and in the right header file.
|
|
|
|
Make sure that you use proper method composition in your code.
|
|
|
|
Please make sure that you compile your solution with warnings enabled and that there are no warnings during compilation. You can do this via the following command:
|
|
g++ -Wall -Wextra -Werror -pedantic lab_2.cpp currency.hpp
|
|
*/
|
|
|
|
#include "currency.hpp"
|
|
#include <iostream>
|
|
|
|
int main() {
|
|
double monetary_value = 8;
|
|
double usd_exchange_rate = 0.23;
|
|
|
|
Currency pln(monetary_value, usd_exchange_rate);
|
|
|
|
if (pln.getValue() != 8) {
|
|
std::cerr << "Error in getValue()" << std::endl;
|
|
}
|
|
if (pln.getUSDExchangeRate() != 0.23) {
|
|
std::cerr << pln.getUSDExchangeRate() << std::endl;
|
|
std::cerr << "Error in getUSDExchangeRate()" << std::endl;
|
|
}
|
|
|
|
pln.setValue(42);
|
|
pln.setUSDExchangeRate(0.24);
|
|
if (pln.getValue() != 42) {
|
|
std::cerr << "Error in setValue()" << std::endl;
|
|
}
|
|
if (pln.getUSDExchangeRate() != 0.24) {
|
|
std::cerr << "Error in setUSDExchangeRate()" << std::endl;
|
|
}
|
|
|
|
Currency gbp(1336, 1.2);
|
|
Currency usd(78, 1);
|
|
|
|
if (gbp.toDollars() != 1603.2) {
|
|
std::cerr << "Error in toDollars() 1" << std::endl;
|
|
}
|
|
if (usd.toDollars() != 78) {
|
|
std::cerr << "Error in toDollars() 2" << std::endl;
|
|
}
|
|
|
|
gbp.setValueFromDollars(1800);
|
|
usd.setValueFromDollars(120);
|
|
pln.setValueFromDollars(180);
|
|
if (gbp.getValue() != 1500) {
|
|
std::cerr << "Error in setValueFromDollars() 1" << std::endl;
|
|
}
|
|
if (usd.getValue() != 120) {
|
|
std::cerr << "Error in setValueFromDollars() 2" << std::endl;
|
|
}
|
|
if (pln.getValue() != 750) {
|
|
std::cerr << "Error in setValueFromDollars() 3" << std::endl;
|
|
}
|
|
|
|
|
|
usd.addValue(gbp);
|
|
if (usd.getValue() != 1920) {
|
|
std::cerr << "Error in addValue() 1" << std::endl;
|
|
}
|
|
gbp.addValue(pln);
|
|
if (gbp.getValue() != 1650) {
|
|
std::cerr << "Error in addValue() 2" << std::endl;
|
|
}
|
|
pln.addValue(usd);
|
|
if (pln.getValue() != 8750) {
|
|
std::cerr << "Error in addValue() 3" << std::endl;
|
|
}
|
|
|
|
|
|
CurrencyView in_gbp(pln, 1.2);
|
|
if (in_gbp.getValue() != 1750) {
|
|
std::cerr << "Error in CurrencyView::getValue() 1" << std::endl;
|
|
}
|
|
pln.setValue(100);
|
|
if (in_gbp.getValue() != 20) {
|
|
std::cerr << "Error in CurrencyView::getValue() 2" << std::endl;
|
|
}
|
|
|
|
|
|
std::cerr << "End of tests." << std::endl;
|
|
return 0;
|
|
}
|