1*c5cf4b8fSDave Lee //===-- SBStructuredDataTest.cpp ------------------------===----------===//
2*c5cf4b8fSDave Lee //
3*c5cf4b8fSDave Lee // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*c5cf4b8fSDave Lee // See https://llvm.org/LICENSE.txt for license information.
5*c5cf4b8fSDave Lee // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*c5cf4b8fSDave Lee //
7*c5cf4b8fSDave Lee //===----------------------------------------------------------------------===/
8*c5cf4b8fSDave Lee 
9*c5cf4b8fSDave Lee #include "gtest/gtest.h"
10*c5cf4b8fSDave Lee 
11*c5cf4b8fSDave Lee #include "lldb/API/SBStringList.h"
12*c5cf4b8fSDave Lee #include "lldb/API/SBStructuredData.h"
13*c5cf4b8fSDave Lee 
14*c5cf4b8fSDave Lee #include <cstring>
15*c5cf4b8fSDave Lee #include <string>
16*c5cf4b8fSDave Lee 
17*c5cf4b8fSDave Lee using namespace lldb;
18*c5cf4b8fSDave Lee 
19*c5cf4b8fSDave Lee class SBStructuredDataTest : public testing::Test {};
20*c5cf4b8fSDave Lee 
TEST_F(SBStructuredDataTest,NullImpl)21*c5cf4b8fSDave Lee TEST_F(SBStructuredDataTest, NullImpl) {
22*c5cf4b8fSDave Lee   SBStructuredData data(nullptr);
23*c5cf4b8fSDave Lee   EXPECT_EQ(data.GetType(), eStructuredDataTypeInvalid);
24*c5cf4b8fSDave Lee   EXPECT_EQ(data.GetSize(), 0ul);
25*c5cf4b8fSDave Lee   SBStringList keys;
26*c5cf4b8fSDave Lee   EXPECT_FALSE(data.GetKeys(keys));
27*c5cf4b8fSDave Lee   EXPECT_EQ(data.GetValueForKey("key").GetType(), eStructuredDataTypeInvalid);
28*c5cf4b8fSDave Lee   EXPECT_EQ(data.GetItemAtIndex(0).GetType(), eStructuredDataTypeInvalid);
29*c5cf4b8fSDave Lee   EXPECT_EQ(data.GetIntegerValue(UINT64_MAX), UINT64_MAX);
30*c5cf4b8fSDave Lee   EXPECT_EQ(data.GetFloatValue(DBL_MAX), DBL_MAX);
31*c5cf4b8fSDave Lee   EXPECT_TRUE(data.GetBooleanValue(true));
32*c5cf4b8fSDave Lee   EXPECT_FALSE(data.GetBooleanValue(false));
33*c5cf4b8fSDave Lee   char dst[1];
34*c5cf4b8fSDave Lee   EXPECT_EQ(data.GetStringValue(dst, sizeof(dst)), 0ul);
35*c5cf4b8fSDave Lee }
36