Jeff Sharkey | 95440eb | 2017-09-18 18:19:28 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | #include <gtest/gtest.h> |
| 18 | |
| 19 | #include "../cryptfs.h" |
| 20 | |
| 21 | namespace android { |
| 22 | |
| 23 | class CryptfsTest : public testing::Test { |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 24 | protected: |
| 25 | virtual void SetUp() {} |
Jeff Sharkey | 95440eb | 2017-09-18 18:19:28 -0600 | [diff] [blame] | 26 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 27 | virtual void TearDown() {} |
Jeff Sharkey | 95440eb | 2017-09-18 18:19:28 -0600 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | TEST_F(CryptfsTest, MatchMultiEntryTest) { |
| 31 | ASSERT_NE(0, match_multi_entry("foo", "foo", 0)); |
| 32 | ASSERT_NE(0, match_multi_entry("foo_0", "foo", 0)); |
| 33 | ASSERT_NE(0, match_multi_entry("foo_1", "foo", 0)); |
| 34 | ASSERT_NE(0, match_multi_entry("foo_2", "foo", 0)); |
| 35 | |
| 36 | ASSERT_EQ(0, match_multi_entry("foo", "foo", 1)); |
| 37 | ASSERT_EQ(0, match_multi_entry("foo_0", "foo", 1)); |
| 38 | ASSERT_NE(0, match_multi_entry("foo_1", "foo", 1)); |
| 39 | ASSERT_NE(0, match_multi_entry("foo_2", "foo", 1)); |
| 40 | |
| 41 | ASSERT_EQ(0, match_multi_entry("foo", "foo", 2)); |
| 42 | ASSERT_EQ(0, match_multi_entry("foo_0", "foo", 2)); |
| 43 | ASSERT_EQ(0, match_multi_entry("foo_1", "foo", 2)); |
| 44 | ASSERT_NE(0, match_multi_entry("foo_2", "foo", 2)); |
| 45 | |
| 46 | ASSERT_EQ(0, match_multi_entry("food", "foo", 0)); |
| 47 | ASSERT_EQ(0, match_multi_entry("foo", "food", 0)); |
| 48 | ASSERT_EQ(0, match_multi_entry("foo", "bar", 0)); |
| 49 | ASSERT_EQ(0, match_multi_entry("foo_2", "bar", 0)); |
| 50 | } |
| 51 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 52 | } // namespace android |