aboutsummaryrefslogtreecommitdiff
path: root/pw_kvs/key_value_store_test.cc
diff options
context:
space:
mode:
authorWyatt Hepler <hepler@google.com>2020-08-03 10:15:56 -0700
committerCQ Bot Account <commit-bot@chromium.org>2020-08-11 20:24:33 +0000
commit6b3a6c9972009e8b9cc7ba87ceafd1f9cca9ce3f (patch)
treefc190a3b9ebbbc11090cf05adc9a8ae4390ab576 /pw_kvs/key_value_store_test.cc
parent6c331aedff19cba24abbc2ce11b7b28d636f5ea0 (diff)
downloadpigweed-6b3a6c9972009e8b9cc7ba87ceafd1f9cca9ce3f.tar.gz
pw_bytes: Utilities for building byte arrays
- Rework pw_kvs_private/byte_utils.h into pw_bytes/array.h. - Remove pw_kvs_private/byte_utils.h and update the KVS code to use the new functions. Change-Id: I55bb861955d67945771391e1887bf3aae37d0f9c Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/15663 Commit-Queue: Wyatt Hepler <hepler@google.com> Reviewed-by: Keir Mierle <keir@google.com> Reviewed-by: David Rogers <davidrogers@google.com>
Diffstat (limited to 'pw_kvs/key_value_store_test.cc')
-rw-r--r--pw_kvs/key_value_store_test.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/pw_kvs/key_value_store_test.cc b/pw_kvs/key_value_store_test.cc
index af981f1a3..b77d078e2 100644
--- a/pw_kvs/key_value_store_test.cc
+++ b/pw_kvs/key_value_store_test.cc
@@ -28,12 +28,12 @@
#endif // DUMP_KVS_STATE_TO_FILE
#include "gtest/gtest.h"
+#include "pw_bytes/array.h"
#include "pw_checksum/ccitt_crc16.h"
#include "pw_kvs/crc16_checksum.h"
#include "pw_kvs/fake_flash_memory.h"
#include "pw_kvs/flash_memory.h"
#include "pw_kvs/internal/entry.h"
-#include "pw_kvs_private/byte_utils.h"
#include "pw_kvs_private/macros.h"
#include "pw_log/log.h"
#include "pw_status/status.h"
@@ -48,12 +48,16 @@ using std::byte;
constexpr size_t kMaxEntries = 256;
constexpr size_t kMaxUsableSectors = 256;
-// Test the functions in byte_utils.h. Create a byte array with AsBytes and
-// ByteStr and check that its contents are correct.
+// Test the functions in byte_utils.h. Create a byte array with bytes::Concat
+// and bytes::String and check that its contents are correct.
constexpr std::array<char, 2> kTestArray = {'a', 'b'};
-constexpr auto kAsBytesTest = AsBytes(
- 'a', uint16_t(1), uint8_t(23), kTestArray, ByteStr("c"), uint64_t(-1));
+constexpr auto kAsBytesTest = bytes::Concat('a',
+ uint16_t(1),
+ uint8_t(23),
+ kTestArray,
+ bytes::String("c"),
+ uint64_t(-1));
static_assert(kAsBytesTest.size() == 15);
static_assert(kAsBytesTest[0] == std::byte{'a'});