1 /********************* */
2 /*! \file array_store_all_white.h
4 ** Top contributors (to current version):
5 ** Andres Noetzli, Morgan Deters, Clark Barrett
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2020 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.\endverbatim
12 ** \brief Black box testing of CVC4::ArrayStoreAll
14 ** Black box testing of CVC4::ArrayStoreAll.
17 #include <cxxtest/TestSuite.h>
19 #include "api/cvc4cpp.h"
20 #include "expr/array_store_all.h"
21 #include "expr/expr.h"
22 #include "expr/expr_manager.h"
23 #include "expr/type.h"
24 #include "smt/smt_engine.h"
25 #include "smt/smt_engine_scope.h"
26 #include "test_utils.h"
31 class ArrayStoreAllWhite
: public CxxTest::TestSuite
36 d_slv
= new api::Solver();
37 d_scope
= new smt::SmtScope(d_slv
->getSmtEngine());
38 d_nm
= d_slv
->getSmtEngine()->d_nodeManager
;
41 void tearDown() override
49 TypeNode usort
= d_nm
->mkSort("U");
50 ArrayStoreAll(d_nm
->mkArrayType(d_nm
->integerType(), d_nm
->realType()),
51 d_nm
->mkConst(Rational(9, 2)));
52 ArrayStoreAll(d_nm
->mkArrayType(d_nm
->mkSort("U"), usort
),
53 d_nm
->mkConst(UninterpretedConstant(usort
, 0)));
54 ArrayStoreAll(d_nm
->mkArrayType(d_nm
->mkBitVectorType(8), d_nm
->realType()),
55 d_nm
->mkConst(Rational(0)));
57 d_nm
->mkArrayType(d_nm
->mkBitVectorType(8), d_nm
->integerType()),
58 d_nm
->mkConst(Rational(0)));
63 TS_ASSERT_THROWS(ArrayStoreAll(d_nm
->integerType(),
64 d_nm
->mkConst(UninterpretedConstant(
65 d_nm
->mkSort("U"), 0))),
66 IllegalArgumentException
&);
68 ArrayStoreAll(d_nm
->integerType(), d_nm
->mkConst(Rational(9, 2))),
69 IllegalArgumentException
&);
71 ArrayStoreAll(d_nm
->mkArrayType(d_nm
->integerType(), d_nm
->mkSort("U")),
72 d_nm
->mkConst(Rational(9, 2))),
73 IllegalArgumentException
&);
78 TypeNode usort
= d_nm
->mkSort("U");
79 TS_ASSERT_THROWS_ANYTHING(ArrayStoreAll(
80 d_nm
->mkArrayType(d_nm
->mkSort("U"), usort
), d_nm
->mkVar(usort
)));
81 TS_ASSERT_THROWS_ANYTHING(ArrayStoreAll(
82 d_nm
->integerType(), d_nm
->mkVar("x", d_nm
->integerType())));
83 TS_ASSERT_THROWS_ANYTHING(
84 ArrayStoreAll(d_nm
->integerType(),
85 d_nm
->mkNode(kind::PLUS
,
86 d_nm
->mkConst(Rational(1)),
87 d_nm
->mkConst(Rational(0)))));
92 smt::SmtScope
* d_scope
;
94 }; /* class ArrayStoreAllBlack */