Skip to content

Commit 7318a0b

Browse files
committed
Removed EXPECT_LEQ_ONE macro
1 parent d22849a commit 7318a0b

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

test/code_generator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def expect_leq_one(self, arg):
145145
146146
:param arg: Argument to check
147147
"""
148-
return self._add_statement(statement_types.FunctionCall("EXPECT_LEQ_ONE", None, arg))
148+
one = self._add_statement(statement_types.IntVariable("int" + self._get_next_name_suffix(), 1))
149+
return self._add_statement(statement_types.FunctionCall("EXPECT_LE", None, arg, one))
149150

150151
def function_call_assign(self, cpp_function_name, *args):
151152
"""

test/code_generator_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def test_expect_eq(self):
5252

5353
def test_expect_leq_one(self):
5454
self.cg.expect_leq_one(self.int_var)
55-
self.assertEqual(self.cg.cpp(), "EXPECT_LEQ_ONE(myint);")
55+
self.assertEqual(self.cg.cpp(), """int int0 = 1;
56+
EXPECT_LE(myint,int0);""")
5657

5758
def test_function_call_assign(self):
5859
self.cg.function_call_assign("stan::math::add", self.real_var1, self.real_var2)

test/expressions/expression_test_helpers.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ void expect_adj_eq(const std::vector<T>& a, const std::vector<T>& b,
166166

167167
void grad(stan::math::var& a) { a.grad(); }
168168

169-
#define EXPECT_LEQ_ONE(x) EXPECT_LE(x, 1)
170169
#define TO_STRING_(x) #x
171170
#define TO_STRING(x) TO_STRING_(x)
172171
#define EXPECT_STAN_EQ(a, b) \

0 commit comments

Comments
 (0)