/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2012-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
CHECK_LE(value, std::numeric_limits<T>::max());
return static_cast<T>(value);
}
-} // anonymous namespace
+} // namespace
+
+TEST(Bits, Boundaries) {
+ uint8_t buf[20];
+ for (size_t offset = 0; offset <= 64; ++offset) {
+ for (size_t size = 0; size <= 32; ++size) {
+ int32_t value = testValue<int32_t>(size);
+ testSet<true>(buf, offset, size, value);
+ EXPECT_EQ(value, (testGet<true, int32_t>(buf, offset, size)));
+ }
+ }
+}
template <size_t N>
void accSize(size_t& w) {