/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2013-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.
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01});
}
+void testVarintFail(std::initializer_list<uint8_t> bytes) {
+ size_t n = bytes.size();
+ ByteRange data(&*bytes.begin(), n);
+ auto ret = tryDecodeVarint(data);
+ EXPECT_FALSE(ret.hasValue());
+}
+
+TEST(Varint, Fail) {
+ testVarintFail({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
+}
+
TEST(ZigZag, Simple) {
EXPECT_EQ(0, encodeZigZag(0));
EXPECT_EQ(1, encodeZigZag(-1));
}
}
-} // namespace
-
-}} // namespaces
+} // namespace
+} // namespace test
+} // namespace folly
int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv);