forked from ad-freiburg/qlever
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConstantsTest.cpp
34 lines (28 loc) · 1.18 KB
/
ConstantsTest.cpp
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
// Copyright 2023, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Author: Robin Textor-Falconi <[email protected]>
#include <gmock/gmock.h>
#include "global/Constants.h"
#include "global/RuntimeParameters.h"
#include "util/GTestHelpers.h"
using namespace ad_utility;
using namespace std::chrono_literals;
using ::testing::AllOf;
using ::testing::HasSubstr;
TEST(Constants, testDefaultQueryTimeoutIsStriclyPositive) {
AD_EXPECT_THROW_WITH_MESSAGE_AND_TYPE(
RuntimeParameters().set<"default-query-timeout">(0s),
AllOf(HasSubstr("default-query-timeout"), HasSubstr("0s")),
std::runtime_error);
AD_EXPECT_THROW_WITH_MESSAGE_AND_TYPE(
RuntimeParameters().set<"default-query-timeout">(-1s),
AllOf(HasSubstr("default-query-timeout"), HasSubstr("-1s")),
std::runtime_error);
EXPECT_NO_THROW(RuntimeParameters().set<"default-query-timeout">(1s));
}
TEST(Constants, makeQleverInternalIri) {
EXPECT_EQ(makeQleverInternalIri("hi", "-bye"),
(makeQleverInternalIriConst<"hi", "-bye">()));
EXPECT_EQ(makeQleverInternalIri("hi", "-bye"),
"<http://qlever.cs.uni-freiburg.de/builtin-functions/hi-bye>");
}