use of helper.CSVStore in project solution-finder by knewjade.
the class PathCSVCaseTest method solution1WithoutHold.
@Test
void solution1WithoutHold() throws Exception {
String fumen = "v115@9gF8DeG8CeH8BeG8MeAgH";
String command = String.format("path -t %s -p *p3 -f csv -k solution -H no", fumen);
System.out.println(command);
Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
assertThat(log.getReturnCode()).isEqualTo(0);
assertThat(log.getOutput()).contains(Messages.foundPath(18));
// column: [fumen, use, num-solutions, num-patterns, solutions, patterns]
CSVStore csvStore = OutputFileHelper.loadPathSolutionCSV();
assertThat(csvStore.size()).isEqualTo(18);
assertThat(csvStore.row("fumen", "http://fumen.zui.jp/?v115@9gF8BthlG8ywH8wwglG8BtglJeAgWDA0iDCA")).contains(entry("use", "TLZ")).contains(entry("num-solutions", "1")).contains(entry("num-patterns", "1")).contains(entry("solutions", "TLZ")).contains(entry("patterns", "TLZ"));
assertThat(csvStore.row("fumen", "http://fumen.zui.jp/?v115@9gF8zhG8RpwwH8xwG8RpwwJeAgWDAUXdBA")).contains(entry("use", "TIO")).contains(entry("num-solutions", "3")).contains(entry("num-patterns", "3")).matches(map -> count(map.get("solutions"), 3), "fail solutions").matches(map -> count(map.get("patterns"), 3), "fail patterns");
assertThat(csvStore.row("fumen", "http://fumen.zui.jp/?v115@9gF8zhG8ywH8wwglG8ilJeAgWDAsedBA")).contains(entry("use", "TIL")).contains(entry("num-solutions", "6")).contains(entry("num-patterns", "6")).matches(map -> count(map.get("solutions"), 6), "fail solutions").matches(map -> count(map.get("patterns"), 6), "fail patterns");
}
use of helper.CSVStore in project solution-finder by knewjade.
the class PathCSVCaseTest method pattern1WithoutHold.
@Test
void pattern1WithoutHold() throws Exception {
String fumen = "v115@9gF8DeG8CeH8BeG8MeAgH";
String command = String.format("path -t %s -p *p4 -f csv -k pattern -H no", fumen);
Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
assertThat(log.getReturnCode()).isEqualTo(0);
assertThat(log.getOutput()).contains(Messages.foundPath(18)).contains(Messages.success(144, 840));
// column: [pattern, num-solutions, use, nouse, fumens]
CSVStore csvStore = OutputFileHelper.loadPathPatternCSV();
assertThat(csvStore.size()).isEqualTo(840);
assertThat(csvStore.row("pattern", "OSJ")).contains(entry("num-solutions", "0")).contains(entry("use", "")).contains(entry("nouse", "")).contains(entry("fumens", ""));
assertThat(csvStore.row("pattern", "JIT")).contains(entry("num-solutions", "1")).contains(entry("use", "TIJ")).contains(entry("nouse", "")).contains(entry("fumens", "v115@9gF8ywwhG8wwg0whH8g0whG8h0whJeAgWDAK+1BA"));
assertThat(csvStore.row("pattern", "TLZ")).contains(entry("num-solutions", "2")).contains(entry("use", "TLZ")).contains(entry("nouse", "")).matches(map -> count(map.get("fumens"), 2), "fail fumens");
}
use of helper.CSVStore in project solution-finder by knewjade.
the class PathCSVCaseTest method pattern2.
@Test
void pattern2() throws Exception {
// reservedオプション
String fumen = "v115@9gE8DewhF8CewhG8BewhF8CewhJeAgH";
String command = String.format("path -t %s -p I,*p4 -f csv -k pattern -r yes", fumen);
Log log = RunnerHelper.runnerCatchingLog(() -> EntryPointMain.main(command.split(" ")));
assertThat(log.getReturnCode()).isEqualTo(0);
assertThat(log.getOutput()).contains(Messages.foundPath(18)).contains(Messages.success(514, 840));
// column: [pattern, num-solutions, use, nouse, fumens]
CSVStore csvStore = OutputFileHelper.loadPathPatternCSV();
assertThat(csvStore.size()).isEqualTo(840);
assertThat(csvStore.row("pattern", "ISZJO")).contains(entry("num-solutions", "0")).contains(entry("use", "")).contains(entry("nouse", "")).contains(entry("fumens", ""));
assertThat(csvStore.row("pattern", "ILZJT")).contains(entry("num-solutions", "1")).contains(entry("use", "TILZ")).contains(entry("nouse", "J")).contains(entry("fumens", "v115@9gE8ywAtwhF8wwBtwhG8AtglwhF8ilwhJeAgWEAMej?xC"));
assertThat(csvStore.row("pattern", "ITLIZ")).contains(entry("num-solutions", "5")).matches(map -> count(map.get("use"), 3), "fail use").matches(map -> count(map.get("nouse"), 3), "fail nouse").matches(map -> count(map.get("fumens"), 5), "fail fumens");
}
use of helper.CSVStore in project solution-finder by knewjade.
the class OutputFileHelper method loadCSVStore.
private static CSVStore loadCSVStore(Path path, List<String> columnNames) throws IOException {
CSVStore csvStore = new CSVStore(columnNames);
Files.lines(path).skip(// skip header
1).forEach(csvStore::load);
return csvStore;
}
Aggregations