ltltest: speed kind.test and consterm.test up
Fixes #52. * src/ltltest/consterm.cc, src/ltltest/kind.cc: Rewrite to read a list of input and expected output. * src/ltltest/kind.test, src/ltltest/consterm.test: Adjust.
This commit is contained in:
parent
2fc816c8a7
commit
ef6d175ace
4 changed files with 210 additions and 172 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2010, 2011, 2012 Laboratoire de Recherche et
|
||||
// Copyright (C) 2010, 2011, 2012, 2015 Laboratoire de Recherche et
|
||||
// Dévelopement de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -18,6 +18,8 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include "ltlparse/public.hh"
|
||||
|
|
@ -36,21 +38,47 @@ main(int argc, char **argv)
|
|||
if (argc != 2)
|
||||
syntax(argv[0]);
|
||||
|
||||
spot::ltl::parse_error_list p1;
|
||||
const spot::ltl::formula* f1 = spot::ltl::parse_sere(argv[1], p1);
|
||||
std::ifstream input(argv[1]);
|
||||
if (!input)
|
||||
{
|
||||
std::cerr << "failed to open " << argv[1] << '\n';
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
|
||||
return 2;
|
||||
std::string s;
|
||||
while (std::getline(input, s))
|
||||
{
|
||||
if (s[0] == '#') // Skip comments
|
||||
{
|
||||
std::cerr << s << '\n';
|
||||
continue;
|
||||
}
|
||||
std::istringstream ss(s);
|
||||
std::string form;
|
||||
bool expected;
|
||||
std::getline(ss, form, ',');
|
||||
ss >> expected;
|
||||
|
||||
bool b = f1->accepts_eword();
|
||||
spot::ltl::parse_error_list p1;
|
||||
const spot::ltl::formula* f1 = spot::ltl::parse_sere(form, p1);
|
||||
if (spot::ltl::format_parse_errors(std::cerr, form, p1))
|
||||
return 2;
|
||||
|
||||
std::cout << b << std::endl;
|
||||
bool b = f1->accepts_eword();
|
||||
std::cout << form << ',' << b << '\n';
|
||||
if (b != expected)
|
||||
{
|
||||
std::cerr << "computed '" << b
|
||||
<< "' but expected '" << expected << "'\n";
|
||||
return 2;
|
||||
}
|
||||
f1->destroy();
|
||||
}
|
||||
|
||||
f1->destroy();
|
||||
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
||||
assert(spot::ltl::unop::instance_count() == 0);
|
||||
assert(spot::ltl::binop::instance_count() == 0);
|
||||
assert(spot::ltl::bunop::instance_count() == 0);
|
||||
assert(spot::ltl::multop::instance_count() == 0);
|
||||
return b;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue