1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Aina Niemetz |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 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 |
|
* Black box testing of cvc5::ArrayStoreAll. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "expr/array_store_all.h" |
17 |
|
#include "test_smt.h" |
18 |
|
|
19 |
|
namespace cvc5 { |
20 |
|
namespace test { |
21 |
|
|
22 |
12 |
class TestUtilWhiteArrayStoreAll : public TestSmt |
23 |
|
{ |
24 |
|
}; |
25 |
|
|
26 |
12 |
TEST_F(TestUtilWhiteArrayStoreAll, store_all) |
27 |
|
{ |
28 |
4 |
TypeNode usort = d_nodeManager->mkSort("U"); |
29 |
4 |
ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->integerType(), |
30 |
4 |
d_nodeManager->realType()), |
31 |
4 |
d_nodeManager->mkConst(Rational(9, 2))); |
32 |
2 |
ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->mkSort("U"), usort), |
33 |
4 |
d_nodeManager->mkConst(UninterpretedConstant(usort, 0))); |
34 |
4 |
ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->mkBitVectorType(8), |
35 |
4 |
d_nodeManager->realType()), |
36 |
4 |
d_nodeManager->mkConst(Rational(0))); |
37 |
4 |
ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->mkBitVectorType(8), |
38 |
4 |
d_nodeManager->integerType()), |
39 |
4 |
d_nodeManager->mkConst(Rational(0))); |
40 |
2 |
} |
41 |
|
|
42 |
12 |
TEST_F(TestUtilWhiteArrayStoreAll, type_errors) |
43 |
|
{ |
44 |
4 |
ASSERT_THROW(ArrayStoreAll(d_nodeManager->integerType(), |
45 |
|
d_nodeManager->mkConst(UninterpretedConstant( |
46 |
|
d_nodeManager->mkSort("U"), 0))), |
47 |
2 |
IllegalArgumentException); |
48 |
4 |
ASSERT_THROW(ArrayStoreAll(d_nodeManager->integerType(), |
49 |
|
d_nodeManager->mkConst(Rational(9, 2))), |
50 |
2 |
IllegalArgumentException); |
51 |
4 |
ASSERT_THROW( |
52 |
|
ArrayStoreAll(d_nodeManager->mkArrayType(d_nodeManager->integerType(), |
53 |
|
d_nodeManager->mkSort("U")), |
54 |
|
d_nodeManager->mkConst(Rational(9, 2))), |
55 |
2 |
IllegalArgumentException); |
56 |
|
} |
57 |
|
|
58 |
12 |
TEST_F(TestUtilWhiteArrayStoreAll, const_error) |
59 |
|
{ |
60 |
4 |
TypeNode usort = d_nodeManager->mkSort("U"); |
61 |
4 |
ASSERT_THROW(ArrayStoreAll(d_nodeManager->mkArrayType( |
62 |
|
d_nodeManager->mkSort("U"), usort), |
63 |
|
d_nodeManager->mkVar(usort)), |
64 |
2 |
IllegalArgumentException); |
65 |
4 |
ASSERT_THROW( |
66 |
|
ArrayStoreAll(d_nodeManager->integerType(), |
67 |
|
d_nodeManager->mkVar("x", d_nodeManager->integerType())), |
68 |
2 |
IllegalArgumentException); |
69 |
4 |
ASSERT_THROW( |
70 |
|
ArrayStoreAll(d_nodeManager->integerType(), |
71 |
|
d_nodeManager->mkNode(kind::PLUS, |
72 |
|
d_nodeManager->mkConst(Rational(1)), |
73 |
|
d_nodeManager->mkConst(Rational(0)))), |
74 |
2 |
IllegalArgumentException); |
75 |
|
} |
76 |
|
} // namespace test |
77 |
40456 |
} // namespace cvc5 |