Skip to content

Commit fed609a

Browse files
Justin-LloydMarusyk
authored andcommitted
IPv6 tests (#9)
IPv6 tests
1 parent ed89c7e commit fed609a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Grok.Net.Tests/UnitTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,24 @@ public void IPv4PatternTest()
104104
Assert.Equal(ipAddress, grokResult[0].Value);
105105
Assert.Equal(comment, grokResult[1].Value);
106106
}
107+
108+
[Theory]
109+
[InlineData("2001:0db8:85a3:0000:0000:8a2e:0370:7334")]
110+
[InlineData("2001:db8:85a3:0:0:8a2e:370:7334")]
111+
[InlineData("2001:db8:85a3::8a2e:370:7334")]
112+
[InlineData("::1")] // Loopback
113+
[InlineData("::")] // Default route
114+
public void IPv6PatternTest(string ipAddress)
115+
{
116+
const string comment = "Free as in Free Beer";
117+
string logs = $"{ipAddress}:{comment}";
118+
string grokPattern = "%{IPV6:IP}:%{GREEDYDATA:comment}";
119+
Grok act = new Grok(grokPattern);
120+
121+
GrokResult grokResult = act.Parse(logs);
122+
123+
Assert.Equal(ipAddress, grokResult[0].Value);
124+
Assert.Equal(comment, grokResult[1].Value);
125+
}
107126
}
108127
}

0 commit comments

Comments
 (0)