product: raise an exception if the dict are different

Fixes #132.

* python/spot.py (translate): Allow changing the dictionary.
* tests/python/prodexpt.py: New file.
* tests/Makefile.am: Add it.
* spot/twa/twaproduct.cc, spot/twaalgos/product.cc: Add them.
* NEWS: Mention the change.
This commit is contained in:
Alexandre Duret-Lutz 2016-01-23 21:24:53 +01:00
parent 78fd7beaaf
commit c4e9083f4e
6 changed files with 55 additions and 6 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014, 2015 Laboratoire de Recherche et
// Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -49,7 +49,9 @@ namespace spot
std::unordered_map<product_state, unsigned, product_state_hash> s2n;
std::deque<std::pair<product_state, unsigned>> todo;
assert(left->get_dict() == right->get_dict());
if (left->get_dict() != right->get_dict())
throw std::runtime_error("product: left and right automata should "
"share their bdd_dict");
auto res = make_twa_graph(left->get_dict());
res->copy_ap_of(left);
res->copy_ap_of(right);