diff --git a/bin/genaut.cc b/bin/genaut.cc
index 0e0526566..598d37ce2 100644
--- a/bin/genaut.cc
+++ b/bin/genaut.cc
@@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
-// Copyright (C) 2017 Laboratoire de Recherche et
-// Développement de l'Epita (LRDE).
+// Copyright (C) 2017 Laboratoire de Recherche et Développement de
+// l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@@ -51,12 +51,11 @@ enum {
OPT_KS_COBUCHI = FIRST_CLASS,
LAST_CLASS,
};
-/*
+
const char* const class_name[LAST_CLASS - FIRST_CLASS] =
{
"ks-cobuchi",
};
-*/
#define OPT_ALIAS(o) { #o, 0, nullptr, OPTION_ALIAS, nullptr, 0 }
@@ -65,9 +64,10 @@ static const argp_option options[] =
/**************************************************/
// Keep this alphabetically sorted (expect for aliases).
{ nullptr, 0, nullptr, 0, "Pattern selection:", 1},
- { "ks-cobuchi", OPT_KS_COBUCHI, "N", 0,
- "A co-Bûchi automaton with 2N+1 states for which any equivalent "
+ { "ks-cobuchi", OPT_KS_COBUCHI, "RANGE", 0,
+ "A co-Büchi automaton with 2N+1 states for which any equivalent "
"deterministic co-Büchi automaton has at least 2^N/(2N+1) states.", 0},
+ RANGE_DOC,
/**************************************************/
{ nullptr, 0, nullptr, 0, "Miscellaneous options:", -1 },
{ nullptr, 0, nullptr, 0, nullptr, 0 }
@@ -84,7 +84,8 @@ static jobs_t jobs;
const struct argp_child children[] =
{
- { &aoutput_argp, 0, nullptr, -20 },
+ { &aoutput_argp, 0, nullptr, 3 },
+ { &aoutput_o_format_argp, 0, nullptr, 4 },
{ &misc_argp, 0, nullptr, -1 },
{ nullptr, 0, nullptr, 0 }
};
@@ -97,16 +98,7 @@ enqueue_job(int pattern, const char* range_str)
j.range = parse_range(range_str);
jobs.push_back(j);
}
-/*
-static void
-enqueue_job(int pattern, int min, int max)
-{
- job j;
- j.pattern = pattern;
- j.range = {min, max};
- jobs.push_back(j);
-}
-*/
+
static int
parse_opt(int key, char* arg, struct argp_state*)
{
@@ -121,18 +113,7 @@ parse_opt(int key, char* arg, struct argp_state*)
}
return 0;
}
-/*
-static void
-bad_number(const char* pattern, int n, int max = 0)
-{
- std::ostringstream err;
- err << "no pattern " << n << " for " << pattern
- << ", supported range is 1..";
- if (max)
- err << max;
- throw std::runtime_error(err.str());
-}
-*/
+
static void
output_pattern(int pattern, int n)
{
@@ -149,7 +130,7 @@ output_pattern(int pattern, int n)
process_timer timer;
automaton_printer printer;
- printer.print(aut, timer);
+ printer.print(aut, timer, nullptr, class_name[pattern - FIRST_CLASS], n);
}
static void
@@ -173,6 +154,8 @@ run_jobs()
int
main(int argc, char** argv)
{
+ strcpy(F_doc, "the name of the pattern");
+ strcpy(L_doc, "the argument of the pattern");
setup(argv);
const argp ap = { options, parse_opt, nullptr, argp_program_doc,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a847bcc11..3f43232e5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -151,6 +151,7 @@ TESTS_tl = \
core/length.test \
core/equals.test \
core/tostring.test \
+ core/genaut.test \
core/genltl.test \
core/lunabbrev.test \
core/tunabbrev.test \
diff --git a/tests/core/genaut.test b/tests/core/genaut.test
new file mode 100644
index 000000000..2660e942f
--- /dev/null
+++ b/tests/core/genaut.test
@@ -0,0 +1,38 @@
+#!/bin/sh
+# -*- coding: utf-8 -*-
+# Copyright (C) 2017 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 .
+
+. ./defs
+set -e
+
+# Make sure the name of each pattern is correctly output by %F.
+opts=`genaut --help | sed -n '/=RANGE/{
+s/^ *//
+s/[=[].*/=1/p
+}'`
+res=`genaut $opts --stats="--%F=%L"`
+test "$opts" = "$res"
+
+genaut --ks-cobuchi=..3 --stats=%s,%e,%t,%c,%g >out
+cat >expected <