Enrico Granata | 60b1cbc | 2019-05-20 11:06:46 -0700 | [diff] [blame^] | 1 | // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include <map> |
| 6 | #include <string> |
| 7 | |
| 8 | #include <gtest/gtest.h> |
| 9 | |
| 10 | #include "mems_setup/delegate_impl.h" |
| 11 | |
| 12 | namespace mems_setup { |
| 13 | |
| 14 | namespace { |
| 15 | |
| 16 | TEST(VpdLoader, WellFormedEntries) { |
| 17 | std::map<std::string, std::string> entries; |
| 18 | std::string data = R"foo("key1"="value1" |
| 19 | "key2"="value2" |
| 20 | )foo"; |
| 21 | ASSERT_TRUE(LoadVpdFromString(data, &entries)); |
| 22 | ASSERT_EQ(2, entries.size()); |
| 23 | ASSERT_EQ("value1", entries.at("key1")); |
| 24 | ASSERT_EQ("value2", entries.at("key2")); |
| 25 | } |
| 26 | |
| 27 | TEST(VpdLoader, NoTrailingNewline) { |
| 28 | std::map<std::string, std::string> entries; |
| 29 | std::string data = R"foo("key1"="value1" |
| 30 | "key2"="value2")foo"; |
| 31 | ASSERT_TRUE(LoadVpdFromString(data, &entries)); |
| 32 | ASSERT_EQ(2, entries.size()); |
| 33 | ASSERT_EQ("value1", entries.at("key1")); |
| 34 | ASSERT_EQ("value2", entries.at("key2")); |
| 35 | } |
| 36 | |
| 37 | } // namespace |
| 38 | |
| 39 | } // namespace mems_setup |