Skip to content

Commit

Permalink
Added lvl0test
Browse files Browse the repository at this point in the history
  • Loading branch information
nindanaoto committed Feb 20, 2024
1 parent a0fc65b commit f764ea5
Showing 1 changed file with 63 additions and 29 deletions.
92 changes: 63 additions & 29 deletions test/gate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,39 +144,73 @@ void RunTest()
vector<TLWE<P>> cres(kNumTests);
vector<TLWE<P>> c(3 * kNumTests);

Test<P>("NOT", TFHEpp::HomNOT<P>, NotChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("COPY", TFHEpp::HomCOPY<P>, CopyChegk, p, cres, c, kNumTests, *sk,
ek);
Test<P>("NAND", TFHEpp::HomNAND<lvl10param, lvl01param, lvl1param::μ>,
NandChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("OR", TFHEpp::HomOR<lvl10param, lvl01param, lvl1param::μ>, OrChegk,
p, cres, c, kNumTests, *sk, ek);
Test<P>("ORYN", TFHEpp::HomORYN<lvl10param, lvl01param, lvl1param::μ>,
OrYNChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ORNY", TFHEpp::HomORNY<lvl10param, lvl01param, lvl1param::μ>,
OrNYChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("AND", TFHEpp::HomAND<lvl10param, lvl01param, lvl1param::μ>,
AndChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ANDYN", TFHEpp::HomANDYN<lvl10param, lvl01param, lvl1param::μ>,
AndYNChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ANDNY", TFHEpp::HomANDNY<lvl10param, lvl01param, lvl1param::μ>,
AndNYChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("XOR", TFHEpp::HomXOR<lvl10param, lvl01param, lvl1param::μ>,
XorChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("XNOR", TFHEpp::HomXNOR<lvl10param, lvl01param, lvl1param::μ>,
XnorChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("MUX", TFHEpp::HomMUX<P>, MuxChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("NMUX", TFHEpp::HomNMUX<P>, NMuxChegk, p, cres, c, kNumTests, *sk,
ek);
Test<P>("ConstantZero", TFHEpp::HomCONSTANTZERO<P>, ConstantZeroChegk, p,
cres, c, kNumTests, *sk, ek);
Test<P>("ConstantOne", TFHEpp::HomCONSTANTONE<P>, ConstantOneChegk, p, cres,
c, kNumTests, *sk, ek);
if constexpr (std::is_same_v<P, lvl0param>) {
cout << "lvl0param" << endl;
Test<P>("NOT", TFHEpp::HomNOT<P>, NotChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("COPY", TFHEpp::HomCOPY<P>, CopyChegk, p, cres, c, kNumTests, *sk,
ek);
Test<P>("NAND", TFHEpp::HomNAND<lvl01param, lvl1param::μ, lvl10param>,
NandChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("OR", TFHEpp::HomOR<lvl01param, lvl1param::μ, lvl10param>, OrChegk,
p, cres, c, kNumTests, *sk, ek);
Test<P>("ORYN", TFHEpp::HomORYN<lvl01param, lvl1param::μ, lvl10param>,
OrYNChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ORNY", TFHEpp::HomORNY<lvl01param, lvl1param::μ, lvl10param>,
OrNYChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("AND", TFHEpp::HomAND<lvl01param, lvl1param::μ, lvl10param>,
AndChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ANDYN", TFHEpp::HomANDYN<lvl01param, lvl1param::μ, lvl10param>,
AndYNChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ANDNY", TFHEpp::HomANDNY<lvl01param, lvl1param::μ, lvl10param>,
AndNYChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("XOR", TFHEpp::HomXOR<lvl01param, lvl1param::μ, lvl10param>,
XorChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("XNOR", TFHEpp::HomXNOR<lvl01param, lvl1param::μ, lvl10param>,
XnorChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("MUX", TFHEpp::HomMUX<P>, MuxChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("NMUX", TFHEpp::HomNMUX<P>, NMuxChegk, p, cres, c, kNumTests, *sk,
ek);
Test<P>("ConstantZero", TFHEpp::HomCONSTANTZERO<P>, ConstantZeroChegk, p,
cres, c, kNumTests, *sk, ek);
Test<P>("ConstantOne", TFHEpp::HomCONSTANTONE<P>, ConstantOneChegk, p, cres,
c, kNumTests, *sk, ek);
}
else if constexpr (std::is_same_v<P, lvl1param>) {
cout << "lvl1param" << endl;
Test<P>("NOT", TFHEpp::HomNOT<P>, NotChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("COPY", TFHEpp::HomCOPY<P>, CopyChegk, p, cres, c, kNumTests, *sk,
ek);
Test<P>("NAND", TFHEpp::HomNAND<lvl10param, lvl01param, lvl1param::μ>,
NandChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("OR", TFHEpp::HomOR<lvl10param, lvl01param, lvl1param::μ>, OrChegk,
p, cres, c, kNumTests, *sk, ek);
Test<P>("ORYN", TFHEpp::HomORYN<lvl10param, lvl01param, lvl1param::μ>,
OrYNChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ORNY", TFHEpp::HomORNY<lvl10param, lvl01param, lvl1param::μ>,
OrNYChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("AND", TFHEpp::HomAND<lvl10param, lvl01param, lvl1param::μ>,
AndChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ANDYN", TFHEpp::HomANDYN<lvl10param, lvl01param, lvl1param::μ>,
AndYNChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("ANDNY", TFHEpp::HomANDNY<lvl10param, lvl01param, lvl1param::μ>,
AndNYChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("XOR", TFHEpp::HomXOR<lvl10param, lvl01param, lvl1param::μ>,
XorChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("XNOR", TFHEpp::HomXNOR<lvl10param, lvl01param, lvl1param::μ>,
XnorChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("MUX", TFHEpp::HomMUX<P>, MuxChegk, p, cres, c, kNumTests, *sk, ek);
Test<P>("NMUX", TFHEpp::HomNMUX<P>, NMuxChegk, p, cres, c, kNumTests, *sk,
ek);
Test<P>("ConstantZero", TFHEpp::HomCONSTANTZERO<P>, ConstantZeroChegk, p,
cres, c, kNumTests, *sk, ek);
Test<P>("ConstantOne", TFHEpp::HomCONSTANTONE<P>, ConstantOneChegk, p, cres,
c, kNumTests, *sk, ek);
}
}

int main()
{
RunTest<lvl1param>();
// RunTest<lvl0param>();
RunTest<lvl0param>();
return 0;
}

0 comments on commit f764ea5

Please sign in to comment.