| 6 | #include "Machines/minimal.hpp" |
| 7 | |
| 8 | int main(int argc, const char** argv) |
| 9 | { |
| 10 | assert(argc > 1); |
| 11 | int my_number = atoi(argv[1]); |
| 12 | int port_base = 9999; |
| 13 | Names N(my_number, 3, "localhost", port_base); |
| 14 | |
| 15 | typedef Rep3Share2<64> share_type; |
| 16 | Machine<share_type> machine(N); |
| 17 | |
| 18 | int n = 1000; |
| 19 | vector<share_type> inputs; |
| 20 | for (int i = 0; i < n; i++) |
| 21 | inputs.push_back(share_type::constant(i, my_number)); |
| 22 | |
| 23 | vector<FunctionArgument> args = {inputs}; |
| 24 | vector<share_type> results(n); |
| 25 | FunctionArgument res(results); |
| 26 | |
| 27 | machine.run_function("trunc_pr", res, args); |
| 28 | |
| 29 | Opener<share_type> MC(machine.get_player(), machine.get_sint_mac_key()); |
| 30 | MC.init_open(); |
| 31 | for (auto& x : results) |
| 32 | MC.prepare_open(x); |
| 33 | MC.exchange(); |
| 34 | |
| 35 | if (my_number == 0) |
| 36 | { |
| 37 | cout << "res: "; |
| 38 | for (int i = 0; i < 10; i++) |
| 39 | cout << MC.finalize_open() << " "; |
| 40 | cout << endl; |
| 41 | } |
| 42 | else |
| 43 | { |
| 44 | for (int i = 0; i < n; i++) |
| 45 | { |
| 46 | auto x = MC.finalize_open(); |
| 47 | if (not (x == (i / 4) or x == (i / 4 + 1))) |
| 48 | { |
| 49 | cerr << "error at " << i << ": " << x << endl; |
| 50 | exit(1); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | } |
nothing calls this directly
no test coverage detected