Add interface for and test the bdd_setxor() function added to Buddy.

* wrap/python/buddy.i (bdd_setxor): New function.
* wrap/python/tests/setxor.py: New file.
* wrap/python/tests/Makefile.am (TESTS): Add setxor.py.
This commit is contained in:
Alexandre Duret-Lutz 2010-11-07 11:15:56 +01:00
parent 4034b7f87f
commit 2b46cb4bab
4 changed files with 62 additions and 2 deletions

View file

@ -1,8 +1,16 @@
2010-11-07 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Add interface for and test the bdd_setxor() function added to Buddy.
* wrap/python/buddy.i (bdd_setxor): New function.
* wrap/python/tests/setxor.py: New file.
* wrap/python/tests/Makefile.am (TESTS): Add setxor.py.
2010-11-06 Alexandre Duret-Lutz <adl@lrde.epita.fr> 2010-11-06 Alexandre Duret-Lutz <adl@lrde.epita.fr>
* src/Makefile.am (libspot_la_LIBADD): Rename libneverclaimparse.la * src/Makefile.am (libspot_la_LIBADD): Rename libneverclaimparse.la
as libneverparse.la. as libneverparse.la.
* src/neverparse/Makefile.am: Install files in * src/neverparse/Makefile.am: Install files in
$(pkgincludedir)/neverparse, not $(pkgincludedir)/neverclaimparse. $(pkgincludedir)/neverparse, not $(pkgincludedir)/neverclaimparse.
2010-11-06 Alexandre Duret-Lutz <adl@lrde.epita.fr> 2010-11-06 Alexandre Duret-Lutz <adl@lrde.epita.fr>

View file

@ -1,3 +1,4 @@
// Copyright (C) 2010 Laboratoire de Recherche et Développement de l'EPITA.
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
@ -155,6 +156,7 @@ bdd bdd_or(const bdd &l, const bdd &r);
bdd bdd_xor(const bdd &l, const bdd &r); bdd bdd_xor(const bdd &l, const bdd &r);
bdd bdd_imp(const bdd &l, const bdd &r); bdd bdd_imp(const bdd &l, const bdd &r);
bdd bdd_biimp(const bdd &l, const bdd &r); bdd bdd_biimp(const bdd &l, const bdd &r);
bdd bdd_setxor(const bdd &l, const bdd &r);
bdd bdd_ite(const bdd &f, const bdd &g, const bdd &h); bdd bdd_ite(const bdd &f, const bdd &g, const bdd &h);
bdd bdd_exist(const bdd &r, const bdd &var); bdd bdd_exist(const bdd &r, const bdd &var);
bdd bdd_existcomp(const bdd &r, const bdd &var); bdd bdd_existcomp(const bdd &r, const bdd &var);

View file

@ -1,3 +1,5 @@
## Copyright (C) 2010 Labortatoire de Recherche et Développement de
## l'EPITA.
## Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), ## Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
## département Systèmes Répartis Coopératifs (SRC), Université Pierre ## département Systèmes Répartis Coopératifs (SRC), Université Pierre
## et Marie Curie. ## et Marie Curie.
@ -35,4 +37,5 @@ TESTS = \
interdep.py \ interdep.py \
minato.py \ minato.py \
modgray.py \ modgray.py \
optionmap.py optionmap.py \
setxor.py

47
wrap/python/tests/setxor.py Executable file
View file

@ -0,0 +1,47 @@
# -*- mode: python; coding: iso-8859-1 -*-
# Copyright (C) 2010 Laboratoire de Recherche et Développement de l'EPITA.
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Spot 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 General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
import ltihooks
import sys
from buddy import *
bdd_init(10000, 10000)
bdd_setvarnum(5)
V = [bdd_ithvar(i) for i in range(5)]
a = V[0] & -V[1] & V[2] & -V[3]
b = V[0] & V[1] & V[2] & -V[3]
c = -V[0] & V[1] & -V[2] & -V[3]
assert(c == bdd_setxor(a,b))
assert(c == bdd_setxor(b,a))
assert(a == bdd_setxor(b,c))
assert(a == bdd_setxor(c,b))
assert(b == bdd_setxor(a,c))
assert(b == bdd_setxor(c,a))
d = V[1] & V[2] & -V[3] & V[4]
e = V[0] & V[1] & -V[2] & -V[3] & V[4]
assert(e == bdd_setxor(a,d))
assert(e == bdd_setxor(d,a))
bdd_done()