forked from microsoft/cppgraphqlgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponseTests.cpp
More file actions
37 lines (27 loc) · 1.02 KB
/
Copy pathResponseTests.cpp
File metadata and controls
37 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include <gtest/gtest.h>
#include "graphqlservice/GraphQLResponse.h"
#include <ranges>
using namespace graphql;
TEST(ResponseCase, ValueConstructorFromStringLiteral)
{
auto expected = "Test String";
auto actual = response::Value(expected);
ASSERT_TRUE(response::Type::String == actual.type());
ASSERT_EQ(expected, actual.release<std::string>());
}
TEST(ResponseCase, IdTypeCompareEqual)
{
const auto fakeId = []() noexcept {
std::string_view fakeIdString { "fakeId" };
response::IdType result(fakeIdString.size());
std::ranges::copy(fakeIdString, result.begin());
return response::IdType { std::move(result) };
}();
EXPECT_TRUE(response::IdType { "" } < fakeId) << "empty string should compare as less";
EXPECT_TRUE(fakeId < response::IdType { "invalid string" })
<< "an invalid string should compare as greater";
EXPECT_TRUE(fakeId == response::IdType { "ZmFrZUlk" })
<< "actual string should compare as equal";
}