Debian Codegraph @

test/api/java/Smt2Compliance.java

raw
1 /******************************************************************************
2 * Top contributors (to current version):
3 * Daniel Larraz
4 *
5 * This file is part of the cvc5 project.
6 *
7 * Copyright (c) 2009-2025 by the authors listed in the file AUTHORS
8 * in the top-level source directory and their institutional affiliations.
9 * All rights reserved. See the file COPYING in the top-level source
10 * directory for licensing information.
11 * ****************************************************************************
12 *
13 * A test of SMT-LIBv2 commands, checks for compliant output.
14 */
15
16 import io.github.cvc5.*;
17 import io.github.cvc5.modes.*;
18
19 public class Smt2Compliance
20 {
21 public static void testGetInfo(Solver solver, String key)
22 {
23 SymbolManager sm = new SymbolManager(solver.getTermManager());
24 InputParser p = new InputParser(solver, sm);
25
26 String s = "(get-info " + key + ")";
27 p.setStringInput(InputLanguage.SMT_LIB_2_6, s, "<internal>");
28
29 Command c = p.nextCommand();
30 assert (!c.isNull());
31
32 System.out.println(c);
33
34 s = c.invoke(solver, sm);
35
36 c = p.nextCommand();
37 assert (c.isNull());
38
39 System.out.println(s);
40 }
41
42 public static void main(String[] args)
43 {
44 TermManager tm = new TermManager();
45 Solver solver = new Solver(tm);
46
47 solver.setOption("input-language", "smtlib2");
48 solver.setOption("output-language", "smtlib2");
49
50 testGetInfo(solver, ":error-behavior");
51 testGetInfo(solver, ":name");
52 testGetInfo(solver, ":authors");
53 testGetInfo(solver, ":version");
54 testGetInfo(solver, ":status");
55 testGetInfo(solver, ":reason-unknown");
56 testGetInfo(solver, ":arbitrary-undefined-keyword");
57 testGetInfo(solver, ":<="); // legal
58 testGetInfo(solver, ":->"); // legal
59 testGetInfo(solver, ":all-statistics");
60
61 System.exit(0);
62 }
63 }