void test(int K, string m, bool t = false){ high_resolution_clock::time_point start, end; if (t){ cerr << "--- " << "K : " << K << " ------------" << endl; } start = high_resolution_clock::now(); Commiter c; end = high_resolution_clock::now(); if (t){ cerr << "init " << time_span(end, start).count() << endl; } // cerr << "commit" << endl; start = high_resolution_clock::now(); Commitment com = c.commit(K, BitUtils::string_to_bits(m)); // cerr << "receiver" << endl; Receiver r; r.accept_commitment(com); end = high_resolution_clock::now(); if (t){ cerr << "commit " << time_span(end, start).count() << endl; } // cerr << "open" << endl; start = high_resolution_clock::now(); Integer vp = c.open(); // cerr << "open" << endl; string m2 = BitUtils::bits_to_string(r.open(vp)); end = high_resolution_clock::now(); if (m != m2){ cerr << "FAIL open" << endl; } else { // cerr << "OK" << endl; } if (t){ cerr << "open " << time_span(end, start).count() << endl; } start = high_resolution_clock::now(); // cerr << "force open" << endl; string m3 = BitUtils::bits_to_string(r.force_open()); if (m != m3){ cerr << "FAIL force open" << endl; } else { // cerr << "OK" << endl; } end = high_resolution_clock::now(); cerr << "force open " << K << ": " << time_span(end, start).count() << endl; if (t){ cerr << "--------------------" << endl; } }