From 81c654a067a2be89d07e1b0fb270c82adb812986 Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Mon, 10 Jun 2024 16:46:01 +0200 Subject: [PATCH] Add test asserting the maximum serialization depth. --- ...ssageSerializationTest.MaxDepth.verified.txt | 1 + .../Graphson3BinaryMessageSerializationTest.cs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/Core.Tests/Serialization/Graphson3BinaryMessageSerializationTest.MaxDepth.verified.txt diff --git a/test/Core.Tests/Serialization/Graphson3BinaryMessageSerializationTest.MaxDepth.verified.txt b/test/Core.Tests/Serialization/Graphson3BinaryMessageSerializationTest.MaxDepth.verified.txt new file mode 100644 index 000000000..885cd5556 --- /dev/null +++ b/test/Core.Tests/Serialization/Graphson3BinaryMessageSerializationTest.MaxDepth.verified.txt @@ -0,0 +1 @@ +!application/vnd.gremlin-v3.0+json{"requestId":"00000000-0000-0000-0000-000000000000","op":"bytecode","processor":"traversal","args":{"gremlin":{"@type":"g:Bytecode","@value":{"step":[["inject",{"@type":"g:Int32","@value":0}],["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["map",{"@type":"g:Bytecode","@value":{"step":[["constant",{"@type":"g:Int32","@value":1}]]}}]]}}]]}}]]}}]]}}]]}}]]}}]]}}]]}}]]}}]]}}]]}}]]}}]]}}]]}},"aliases":{"g":"g"}}} \ No newline at end of file diff --git a/test/Core.Tests/Serialization/Graphson3BinaryMessageSerializationTest.cs b/test/Core.Tests/Serialization/Graphson3BinaryMessageSerializationTest.cs index 6bb9d0104..5a9be7a30 100644 --- a/test/Core.Tests/Serialization/Graphson3BinaryMessageSerializationTest.cs +++ b/test/Core.Tests/Serialization/Graphson3BinaryMessageSerializationTest.cs @@ -11,5 +11,22 @@ public Graphson3BinaryMessageSerializationTest(GremlinqFixture fixture) : base( new BinaryMessageSerializingVerifier()) { } + + + [Fact] + public Task MaxDepth() + { + return _g + .Inject(0) + .Map(GetLambda(13)) + .Verify(); + } + + private Func, IGremlinQuery> GetLambda(int i) + { + return i == 0 + ? __ => __.Constant(1) + : __ => __.Map(GetLambda(i - 1)); + } } }