aboutsummaryrefslogtreecommitdiff
path: root/tests/cppbor_test.cpp
diff options
context:
space:
mode:
authorVikram Gaur <vikramgaur@google.com>2022-03-22 20:19:44 +0000
committerVikram Gaur <vikramgaur@google.com>2022-03-23 17:35:50 +0000
commit61d9bff9605ad2ffd877bd99a3bde414e21f01a2 (patch)
tree185c84cdb381e7778dedd07a03929ee6de377f9f /tests/cppbor_test.cpp
parent237ccfe4c30633c1829d83d293e23bc82bcff4d9 (diff)
downloadlibcppbor-61d9bff9605ad2ffd877bd99a3bde414e21f01a2.tar.gz
Fixing minor bugs in libcppbor.
Disambiguated references to UINT, BOOLEAN Undefined TRUE/FALSE so that we can refer to the data types in CBOR. Added required headers. Change-Id: I762fc9bc18fcb79e6f94bf1871d6ffe5c5790997 Test: Existing test cases pass.
Diffstat (limited to 'tests/cppbor_test.cpp')
-rw-r--r--tests/cppbor_test.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/cppbor_test.cpp b/tests/cppbor_test.cpp
index 7756387..68778dc 100644
--- a/tests/cppbor_test.cpp
+++ b/tests/cppbor_test.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <cstdint>
#include <iomanip>
#include <sstream>
@@ -27,13 +28,11 @@ using namespace cppbor;
using namespace std;
using ::testing::_;
-using ::testing::AllOf;
using ::testing::ByRef;
using ::testing::InSequence;
using ::testing::IsNull;
using ::testing::NotNull;
using ::testing::Return;
-using ::testing::Truly;
using ::testing::Unused;
string hexDump(const string& str) {
@@ -254,7 +253,6 @@ TEST(MakeEntryTest, StdStrings) {
details::makeItem(s2)->toString()); // copy of const string
EXPECT_EQ("\x65\x68\x65\x6c\x6c\x6f"s,
details::makeItem(std::move(s1))->toString()); // move string
- EXPECT_EQ(0U, s1.size()); // Prove string was moved, not copied.
}
TEST(MakeEntryTest, StdStringViews) {
@@ -716,7 +714,7 @@ TEST(EqualityTest, ViewBstr) {
TEST(ConvertTest, Uint) {
unique_ptr<Item> item = details::makeItem(10);
- EXPECT_EQ(UINT, item->type());
+ EXPECT_EQ(cppbor::UINT, item->type());
EXPECT_NE(nullptr, item->asInt());
EXPECT_NE(nullptr, item->asUint());
EXPECT_EQ(nullptr, item->asNint());
@@ -803,7 +801,7 @@ TEST(ConvertTest, Bool) {
EXPECT_EQ(nullptr, item->asViewTstr());
EXPECT_EQ(nullptr, item->asViewBstr());
- EXPECT_EQ(BOOLEAN, item->asSimple()->simpleType());
+ EXPECT_EQ(cppbor::BOOLEAN, item->asSimple()->simpleType());
EXPECT_NE(nullptr, item->asSimple()->asBool());
EXPECT_EQ(nullptr, item->asSimple()->asNull());
@@ -965,7 +963,7 @@ TEST(ConvertTest, ViewBstr) {
TEST(CloningTest, Uint) {
Uint item(10);
auto clone = item.clone();
- EXPECT_EQ(clone->type(), UINT);
+ EXPECT_EQ(clone->type(), cppbor::UINT);
EXPECT_NE(clone->asUint(), nullptr);
EXPECT_EQ(item, *clone->asUint());
EXPECT_EQ(*clone->asUint(), Uint(10));
@@ -1025,7 +1023,7 @@ TEST(CloningTest, Bool) {
auto clone = item.clone();
EXPECT_EQ(clone->type(), SIMPLE);
EXPECT_NE(clone->asSimple(), nullptr);
- EXPECT_EQ(clone->asSimple()->simpleType(), BOOLEAN);
+ EXPECT_EQ(clone->asSimple()->simpleType(), cppbor::BOOLEAN);
EXPECT_NE(clone->asSimple()->asBool(), nullptr);
EXPECT_EQ(item, *clone->asSimple()->asBool());
EXPECT_EQ(*clone->asSimple()->asBool(), Bool(true));