Lekce 22 (10. března 2022)

Ant: sestavování softwaru

javac JedenSouborSeZdrojakem.java

Příklad

$ ant
Buildfile: .../build.xml

compile:
    [mkdir] Created dir: .../out/classes
    [javac] Compiling 2 source files to .../out/classes

jar:
      [jar] Building jar: .../out/polynomial.jar

main:

BUILD SUCCESSFUL
Total time: 0 seconds
$ ant test

Buildfile: .../build.xml

compile:

compile-test:
    [mkdir] Created dir: .../out/test-classes
    [javac] Compiling 3 source files to .../out/test-classes

test:
    [mkdir] Created dir: .../out/test-results
    [junit] Running cz.alej.prog1.polynomial.PolynomialBaseTest
    [junit] Tests run: 15, Failures: 10, Errors: 0, Skipped: 0, Time elapsed: 0,164 sec
    [junit] Output:
    [junit] Creating polynomial 7 * x^0 + 8 * x^1 + 9 * x^2 ...
    [junit] Creating polynomial 7 * x^0 + 8 * x^1 + 9 * x^2 ...
    [junit] Creating polynomial 0 * x^0 ...
    [junit] Creating polynomial 42 * x^0 ...
    [junit] Creating polynomial 42 * x^0 ...
    [junit] Creating polynomial 7 * x^0 + 8 * x^1 + 9 * x^2 ...
    [junit] Creating polynomial 7 * x^0 + 8 * x^1 + 9 * x^2 + 10 * x^3 ...
    [junit] Creating polynomial ...
    [junit] Creating polynomial 7 * x^0 + 8 * x^1 + 9 * x^2 ...
    [junit] Creating polynomial 1 * x^0 + 2 * x^1 + 1 * x^2 ...
    [junit] Creating polynomial -3 * x^0 + 5 * x^1 + 0 * x^2 ...
    [junit] Creating polynomial 7 * x^0 + 8 * x^1 + 9 * x^2 ...
    [junit] Creating polynomial 17 * x^0 + 0 * x^1 + -2 * x^2 + -5 * x^3 ...
    [junit] Creating polynomial 3 * x^0 + 0 * x^1 + 5 * x^2 ...
    [junit] Creating polynomial 0 * x^0 + 0 * x^1 + 0 * x^2 ...
    [junit]
    [junit] Test cz.alej.prog1.polynomial.PolynomialBaseTest FAILED
    [junit] Running cz.alej.prog1.polynomial.PolynomialProductTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0,14 sec
    [junit] Running cz.alej.prog1.polynomial.PolynomialSumTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0,145 sec
[junitreport] Processing .../out/test-results/TESTS-TestSuites.xml to /tmp/null1223240972
[junitreport] Loading stylesheet jar:file:/usr/share/ant/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 632ms
[junitreport] Deleting: /tmp/null1223240972
     [echo] Open .../out/test-results/html/index.html to see results in the browser.

BUILD FAILED
.../build.xml:88: JUnit test(s) failed.

Total time: 3 seconds

Úloha

StringBuilder result = new StringBuilder("Polynomial[");
for (int deg = 0; deg <= getDegree(); deg++) {
    if (deg > 0) {
        result.append(",");
    }
    result.append(getCoefficient(deg));
}
result.append("]");
return result.toString();
Licence Creative Commons
Alej.alisma.cz, jejímž autorem je Vojtěch Horký, podléhá licenci
Creative Commons Uveďte autora-Zachovejte licenci 4.0 International.