2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "nest/VarContext.h"
19 #include <gtest/gtest.h>
21 TEST(VAR_CONTEXT, make)
25 auto var_0 = ctx.make();
26 auto var_1 = ctx.make();
28 ASSERT_FALSE(var_0.id() == var_1.id());
31 TEST(VAR_CONTEXT, count)
35 ASSERT_EQ(0, ctx.count());
37 auto var_0 = ctx.make();
39 ASSERT_EQ(1, ctx.count());
41 auto var_1 = ctx.make();
43 ASSERT_EQ(2, ctx.count());
46 TEST(VAR_CONTEXT, bound_one)
50 auto var_0 = ctx.make();
52 ASSERT_EQ(0, ctx.bound(var_0).min());
53 ASSERT_EQ(0, ctx.bound(var_0).max());
55 ctx.bound(var_0) = nest::Bound{-3, 5};
57 ASSERT_EQ(-3, ctx.bound(var_0).min());
58 ASSERT_EQ(5, ctx.bound(var_0).max());
61 TEST(VAR_CONTEXT, bound_independent)
65 auto var_0 = ctx.make();
67 ASSERT_EQ(0, ctx.bound(var_0).min());
68 ASSERT_EQ(0, ctx.bound(var_0).max());
70 auto var_1 = ctx.make();
72 ASSERT_EQ(0, ctx.bound(var_1).min());
73 ASSERT_EQ(0, ctx.bound(var_1).max());
75 ctx.bound(var_0) = nest::Bound{-3, 5};
77 ASSERT_EQ(-3, ctx.bound(var_0).min());
78 ASSERT_EQ(5, ctx.bound(var_0).max());
80 ASSERT_EQ(0, ctx.bound(var_1).min());
81 ASSERT_EQ(0, ctx.bound(var_1).max());