|
|
@@ -8,6 +8,7 @@
|
|
|
#include <jvalidate/detail/anchor.h>
|
|
|
#include <jvalidate/detail/number.h>
|
|
|
#include <jvalidate/detail/pointer.h>
|
|
|
+#include <jvalidate/detail/reference.h>
|
|
|
#include <jvalidate/detail/relative_pointer.h>
|
|
|
#include <jvalidate/detail/string.h>
|
|
|
#include <jvalidate/detail/string_adapter.h>
|
|
|
@@ -105,6 +106,30 @@ TEST(RelatvivePointerTest, CanGoUpAndDown) {
|
|
|
<< rel;
|
|
|
}
|
|
|
|
|
|
+TEST(ReferenceTest, Print) {
|
|
|
+ EXPECT_THAT(testing::PrintToString(Reference(jvalidate::URI("file://path/to/document.json"),
|
|
|
+ Anchor("Anchor"), Pointer("/key/1/id"))),
|
|
|
+ "file://path/to/document.json#Anchor/key/1/id");
|
|
|
+}
|
|
|
+
|
|
|
+TEST(ReferenceTest, RelativeBasedOnURIRelative) {
|
|
|
+ {
|
|
|
+ jvalidate::URI uri("file://path/to/document.json");
|
|
|
+ EXPECT_FALSE(uri.is_relative());
|
|
|
+ EXPECT_THAT(RootReference(uri).is_relative(), uri.is_relative());
|
|
|
+ }
|
|
|
+ {
|
|
|
+ jvalidate::URI uri("/path/to/document.json");
|
|
|
+ EXPECT_FALSE(uri.is_relative());
|
|
|
+ EXPECT_THAT(RootReference(uri).is_relative(), uri.is_relative());
|
|
|
+ }
|
|
|
+ {
|
|
|
+ jvalidate::URI uri("path/to/document.json");
|
|
|
+ EXPECT_TRUE(uri.is_relative());
|
|
|
+ EXPECT_THAT(RootReference(uri).is_relative(), uri.is_relative());
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
template <typename T> class NumberFromStrTest : public Test {};
|
|
|
|
|
|
using Integers = Types<char, size_t, int>;
|