use of material.beam.slant.RossBeamSlant in project Zong by Xenoage.
the class SingleStaffBeamPlacerTest method computeForOneStaffTestRoss.
/**
* Tests with examples from Ross.
*/
@Test
public void computeForOneStaffTestRoss() {
List<Example> examples = new RossBeamSlant().getExamples();
List<ExampleResult> results = alist();
for (Example example : examples) {
// collect data
BeamedStems stems = example.getStems();
Slant slant = singleStaffBeamSlanter.compute(stems, 5);
// run test
Placement offset = testee.compute(slant, stems, 1, StaffLines.Companion.getStaff5Lines());
// check result
ExampleResult result = check(offset, example);
results.add(result);
}
// success, when 100% of the examples are perfect or at least accepted
// print accepted and failed results
int perfect = 0, accepted = 0, failed = 0;
for (ExampleResult result : results) {
if (result.getResult() != Result.Perfect) {
System.out.print(result.getExample().getName() + ": ");
if (result.getResult() == Result.Accepted) {
accepted++;
System.out.print("not perfect, but accepted");
} else {
failed++;
System.out.print("FAILED");
}
if (result.getComment() != null)
System.out.print("; " + result.getComment());
System.out.println();
} else {
perfect++;
}
}
System.out.println(SingleStaffBeamPlacerTest.class.getSimpleName() + ": " + perfect + " perfect, " + accepted + " accepted, " + failed + " failed");
if (failed > 0)
fail();
}
use of material.beam.slant.RossBeamSlant in project Zong by Xenoage.
the class SingleStaffBeamSlanterTest method computeTest.
@Test
public void computeTest() {
// use tests from Ross and Chlapik
for (Suite<Example> suite : alist(new RossBeamSlant(), new ChlapikBeamSlant())) {
for (Example example : suite.getExamples()) {
float expectedSlant = example.getSlantIs();
Slant slant = testee.compute(example.getStems(), example.staffLines);
assertSlantContains(expectedSlant, slant, suite.getName() + ": " + example.name);
}
}
}
Aggregations