@Override public DRes<Void> buildComputation(ProtocolBuilderBinary builder) { return builder.seq(seq -> { List<SBool> unfolded = this.string.stream().map(DRes::out).collect(Collectors.toList()); List<DRes<Boolean>> bools = new ArrayList<>(); for (SBool b : unfolded) { bools.add(seq.binary().open(b)); } return () -> bools; }).seq((seq, res) -> { StringBuilder sb = new StringBuilder(); sb.append(label); sb.append('\n'); for (DRes<Boolean> entry : res) { if (entry.out()) { sb.append(1); } else { sb.append(0); } } seq.debug().marker(sb.toString(), output); return null; }); } }
@Override public void test() throws Exception { Application<Void, ProtocolBuilderBinary> app = producer -> producer.seq(seq -> { List<DRes<SBool>> toPrint = BooleanHelper.known(new Boolean[] {true, false, false, true}, seq.binary()); return () -> toPrint; }).seq((seq, inputs) -> { seq.debug().openAndPrint("test", inputs, stream); seq.debug().marker("test", stream); return null; }); runApplication(app); String output = bytes.toString("UTF-8"); Assert.assertEquals("test\n1001\ntest\n", output.replace("\r", "")); } };
@Override public void test() throws Exception { Application<Void, ProtocolBuilderBinary> app = producer -> producer.seq(seq -> { List<DRes<SBool>> toPrint = BooleanHelper.known(new Boolean[] {true, false, false, true}, seq.binary()); return () -> toPrint; }).seq((seq, inputs) -> { seq.debug().openAndPrint("test", inputs); seq.debug().marker("test"); return null; }); runApplication(app); } };