]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2355 in SNORT/snort3 from ~SMINUT/snort3:tcp_fp_io_utests to...
authorMasud Hasan (mashasan) <mashasan@cisco.com>
Wed, 29 Jul 2020 02:31:35 +0000 (02:31 +0000)
committerMasud Hasan (mashasan) <mashasan@cisco.com>
Wed, 29 Jul 2020 02:31:35 +0000 (02:31 +0000)
Squashed commit of the following:

commit 5828d286745205da9201466f9f09fd2ba609f8b2
Author: Silviu Minut <sminut@cisco.com>
Date:   Tue Jul 28 14:03:44 2020 -0400

    rna: tcp fingerprint input and retrieval

src/network_inspectors/rna/rna_fingerprint_tcp.cc
src/network_inspectors/rna/rna_fp_reader.cc

index 206961f8cfce102daedbaa9a618285a29400ca7b..f26d1df3bf82da7ea73ff308468a45d2356faed7 100644 (file)
 
 #include "rna_fingerprint_tcp.h"
 
+#ifdef UNIT_TEST
+#include "catch/snort_catch.h"
+#endif
+
 using namespace snort;
 using namespace std;
 
@@ -60,3 +64,15 @@ void TcpFpProcessor::push(const vector<FpTcpFingerprint>& fplist, TCP_FP_MODE mo
 }
 
 }
+
+#ifdef UNIT_TEST
+TEST_CASE("get_tcp_fp_processor", "[tcp_processor]")
+{
+    vector<FpTcpFingerprint> fplist;
+    tcp_fp_processor.push(fplist, TcpFpProcessor::TCP_FP_MODE::SERVER);
+
+    snort::TcpFpProcessor* tfp = snort::get_tcp_fp_processor();
+    CHECK(tfp == &tcp_fp_processor);
+}
+
+#endif
index 67efd1f1aa915146a9cb6233efc3d645509a5ea7..57ef652adde83332ea3406b21a0cb3509a6c0312 100644 (file)
 
 #include "rna_fp_reader.h"
 
+#ifdef UNIT_TEST
+#include "catch/snort_catch.h"
+#endif
+
 using namespace snort;
 
 static RnaFingerprintReader* fp_reader = nullptr;
@@ -42,3 +46,16 @@ void set_rna_fp_reader(RnaFingerprintReader* fpr)
 }
 
 }
+
+#ifdef UNIT_TEST
+TEST_CASE("rna_fp_reader", "[rna_fp_reader]")
+{
+    RnaFingerprintReader rna_fp_reader;
+    snort::set_rna_fp_reader(&rna_fp_reader);
+    CHECK(fp_reader == &rna_fp_reader);
+
+    const RnaFingerprintReader* fpr = snort::get_rna_fp_reader();
+    CHECK(fp_reader == fpr);
+}
+
+#endif