# HG changeset patch # User Sigurd Meldgaard <[EMAIL PROTECTED]> # Date 1221574270 -7200 # Node ID 9f166758d6536eafa20326c840bd5e0278d5e4b1 # Parent 1ac057be46ae0eeb0f23b0c4581aede1ed49b80c Test of robabilistic equality mix-in * * *
diff -r 1ac057be46ae -r 9f166758d653 viff/test/test_equality.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/viff/test/test_equality.py Tue Sep 16 16:11:10 2008 +0200 @@ -0,0 +1,19 @@ +# Copyright 2007, 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/>. + +#: Declare doctests for Trial. +__doctests__ = ['viff.equality'] diff -r 1ac057be46ae -r 9f166758d653 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
