# HG changeset patch # User Sigurd Meldgaard <[EMAIL PROTECTED]> # Date 1221574270 -7200 # Node ID 5aa168c8778a1e2909cda7c1ea08da8501b66a95 # Parent a0b713380c029ca32f42e5fa1b4d8752f74e578b Test of robabilistic equality mix-in * * *
diff -r a0b713380c02 -r 5aa168c8778a viff/test/test_runtime_equal.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/viff/test/test_runtime_equal.py Tue Sep 16 16:11:10 2008 +0200 @@ -0,0 +1,67 @@ +# Copyright 2008 VIFF Development Team. +# +# This file is part of VIFF, the Virtual Ideal Functionality Framework. +# +# VIFF is free software: you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License (LGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# VIFF is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with VIFF. If not, see <http://www.gnu.org/licenses/>. + + +"""Tests of the equality protocol(s).""" + +import operator + +from viff.equality import ProbabilisticEqualityMixin +from viff.test.util import RuntimeTestCase, BinaryOperatorTestCase +from viff.runtime import Runtime + + +class EqualRuntime(Runtime, ProbabilisticEqualityMixin): + """A runtime with the equality mixin.""" + pass + + +class ProbabilisticEqualityTestDifferent(BinaryOperatorTestCase, + RuntimeTestCase): + """Testin the equality with a and b different.""" + # Arbitrarily chosen + a = 12442 + b = 91243 + runtime_class = EqualRuntime + operator = operator.eq + + +class ProbabilisticEqualityTestEqual(BinaryOperatorTestCase, RuntimeTestCase): + """Testin the equality with a and b equal.""" + a = 4023 + b = 4023 + runtime_class = EqualRuntime + operator = operator.eq + + +class ProbabilisticEqualityTestDiff1_1(BinaryOperatorTestCase, + RuntimeTestCase): + """Testin the equality with a and b different by only one.""" + a = 0 + b = 1 + runtime_class = EqualRuntime + operator = operator.eq + + +class ProbabilisticEqualityTestDiff1_2(BinaryOperatorTestCase, + RuntimeTestCase): + """Testin the equality with a and b different by only in the other + direction.""" + a = 1 + b = 0 + runtime_class = EqualRuntime + operator = operator.eq _______________________________________________ viff-patches mailing list [email protected] http://lists.viff.dk/listinfo.cgi/viff-patches-viff.dk
