blob: 50b7ad10d10737765694873bc24a53d425f982d5 [file] [log] [blame]
Adam Lesinskidcdfe9f2014-11-06 12:54:36 -08001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#ifndef H_AAPT_SPLIT_TEST_RULES
18#define H_AAPT_SPLIT_TEST_RULES
19
20#include "Rule.h"
21
22#include <gtest/gtest.h>
23
24namespace split {
25namespace test {
26
27struct AndRule : public Rule {
28 AndRule() {
29 op = Rule::AND_SUBRULES;
30 }
31
32 AndRule& add(const Rule& rhs) {
33 subrules.add(new Rule(rhs));
34 return *this;
35 }
36};
37
38struct OrRule : public Rule {
39 OrRule() {
40 op = Rule::OR_SUBRULES;
41 }
42
43 OrRule& add(const Rule& rhs) {
44 subrules.add(new Rule(rhs));
45 return *this;
46 }
47};
48
49const Rule EqRule(Rule::Key key, long value);
50const Rule LtRule(Rule::Key key, long value);
51const Rule GtRule(Rule::Key key, long value);
52const Rule ContainsAnyRule(Rule::Key key, const char* str1);
53const Rule ContainsAnyRule(Rule::Key key, const char* str1, const char* str2);
54const Rule AlwaysTrue();
55
56::testing::AssertionResult RulePredFormat(
57 const char* actualExpr, const char* expectedExpr,
58 const android::sp<Rule>& actual, const Rule& expected);
59
60#define EXPECT_RULES_EQ(actual, expected) \
61 EXPECT_PRED_FORMAT2(::split::test::RulePredFormat, actual, expected)
62
63} // namespace test
64} // namespace split
65
66#endif // H_AAPT_SPLIT_TEST_RULES