spot/tests/sanity/namedprop.test
Alexandre Duret-Lutz 31a681c285 twa: implement a copy_named_properties_of() method
It was noted in #470 that make_twa_graph did not copy named
properties.  Let's fix that.

* spot/twa/twa.hh, spot/twa/twa.cc (copy_named_properties_of): New
method.
* spot/twa/twagraph.hh (make_twa_graph): Add an extra argument to
call copy_named_properties_of() optionally.
* python/spot/__init__.py (twa_graph.__copy__): Use it.
* tests/python/twagraph.py: Test that.
* tests/sanity/namedprop.test: Ensure copy_named_properties_of copies
all known named properties.
2021-07-08 10:33:15 +02:00

73 lines
2.1 KiB
Bash
Executable file

#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2017, 2021 Laboratoire de Recherche et Développement de
# l'Epita (LRDE).
#
# 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
# We used to loop over more directories before the source tree was
# rearranged. So there is only one left today, but we keep the loop
# in case we want to add more in the future.
set +x
DOC=doc/org/concepts.org
CPY=spot/twa/twa.cc
err=0
rm -f namedprop.log
TOP=${srcdir-.}/../..
for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do
find "$dir" \( -name "${1-*}.hh" \
-o -name "${1-*}.hxx" \
-o -name "${1-*}.cc" \
-o -name "${1-*}.test" \) \
-a -not -path '*.dir/*' \
-a -type f -a -print
done |
xargs sed -n 's/.*get_named_prop<.*>("\([^"]*\)").*/\1/p
s/.*set_named_prop("\([^"]*\)",.*/\1/p' |
sort | uniq > proplist.lst
while read prop; do
if ! grep -q "$prop" "$TOP/$DOC"; then
echo "* $prop" >>namedprop.log
fi
done < proplist.lst
if test -f namedprop.log; then
echo "The following named properties are not documented in $DOC:"
cat namedprop.log
err=1
fi
rm -f namedprop.log
while read prop; do
if ! grep -q "COPY_PROP.*$prop" "$TOP/$CPY"; then
echo "* $prop" >>namedprop.log
fi
done < proplist.lst
if test -f namedprop.log; then
echo "These properties are not copied by copy_named_properties_of() ($CPY):"
cat namedprop.log
err=1
fi
rm -f namedprop.log proplist.lst
exit $err