summaryrefslogtreecommitdiff
path: root/test/unit/util/subrange_bound_white.h
blob: 71947b2976306c2488d5d0bf98eb0418844861ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*********************                                                        */
/*! \file subrange_bound_white.h
 ** \verbatim
 ** Original author: Morgan Deters
 ** Major contributors: none
 ** Minor contributors (to current version): none
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2014  New York University and The University of Iowa
 ** See the file COPYING in the top-level source directory for licensing
 ** information.\endverbatim
 **
 ** \brief White-box testing of CVC4::SubrangeBound
 **
 ** White-box testing of CVC4::SubrangeBound.
 **/

#include "util/subrange_bound.h"
#include "util/integer.h"

#include <string>
#include <sstream>

using namespace CVC4;
using namespace std;

class SubrangeBoundWhite : public CxxTest::TestSuite {
  stringstream ss;

public:

  void testInfinite() {
    SubrangeBound b;
    TS_ASSERT( ! b.hasBound() );
    TS_ASSERT_THROWS( b.getBound(), IllegalArgumentException );
    ss.str(""); ss << b;
    TS_ASSERT_EQUALS( ss.str(), "_" );
  }

  void testZero() {
    SubrangeBound b1(0), b2(Integer("0")), b3(Integer("1"));
    TS_ASSERT( b1.hasBound() && b2.hasBound() && b3.hasBound() );
    TS_ASSERT( b1.getBound() == 0 && b2.getBound() == 0 && b3.getBound() == 1 );
    TS_ASSERT( b1 == b2 ); TS_ASSERT( b2 == b1 );
    TS_ASSERT( !(b1 == b3) ); TS_ASSERT( !(b3 == b1) );
    TS_ASSERT( !(b2 == b3) ); TS_ASSERT( !(b3 == b2) );
    TS_ASSERT( !(b1 != b2) ); TS_ASSERT( !(b2 != b1) );
    TS_ASSERT( b1 != b3 ); TS_ASSERT( b3 != b1 );
    TS_ASSERT( b2 != b3 ); TS_ASSERT( b3 != b2 );
    ss.str(""); ss << b1;
    TS_ASSERT( ss.str() == "0" );
    ss.str(""); ss << b2;
    TS_ASSERT( ss.str() == "0" );
    ss.str(""); ss << b3;
    TS_ASSERT( ss.str() == "1" );
  }

  void testOne() {
    SubrangeBound b(Integer("1"));
    TS_ASSERT( b.hasBound() );
    TS_ASSERT( b.getBound() == 1 );
    ss.str(""); ss << b;
    TS_ASSERT( ss.str() == "1" );
  }

  void testMinusOne() {
  }

  void testLarge() {
  }

  void testSmall() {
  }

};/* class SubrangeBoundWhite */

generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback