blob: 8bbc4c3b02485a891f234fcd4ce5bd2455224654 (
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
|
/********************* */
/*! \file recursion_breaker_black.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 Black-box testing of RecursionBreaker<T>
**
** Black-box testing of RecursionBreaker<T>.
**/
#include <iostream>
#include <string>
#include "util/recursion_breaker.h"
using namespace CVC4;
using namespace std;
class RecursionBreakerBlack : public CxxTest::TestSuite {
int d_count;
public:
void setUp() {
d_count = 0;
}
int foo(int x) {
RecursionBreaker<int> breaker("foo", x);
if(breaker.isRecursion()) {
++d_count;
return 0;
}
int xfactor = x * x;
if(x > 0) {
xfactor = -xfactor;
}
int y = foo(11 * x + xfactor);
int z = y < 0 ? y : x * y;
cout << "x == " << x << ", y == " << y << " ==> " << z << endl;
return z;
}
void testFoo() {
foo(5);
TS_ASSERT( d_count == 1 );
}
};/* class RecursionBreakerBlack */
|