From 1dd68eb0d0acfee87631fb012409ef1a661c19ae Mon Sep 17 00:00:00 2001 From: EricLiu2000 Date: Tue, 25 Jun 2019 17:47:26 -0400 Subject: [PATCH] Test framework tentatively working on windows --- test/main.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/main.cpp b/test/main.cpp index fd7a178..bbc1ba7 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,7 +1,23 @@ +#include "icsneo/api/eventmanager.h" #include "gtest/gtest.h" -int main(int argc, char** argv) -{ +using namespace icsneo; + +class EventManagerTest : public ::testing::Test { + +}; + +TEST_F(EventManagerTest, GetLastErrorTest) { + EventManager::GetInstance().add(APIEvent(APIEvent::Type::OutputTruncated, APIEvent::Severity::Error)); + EXPECT_EQ(EventManager::GetInstance().getLastError().getType(), APIEvent::Type::OutputTruncated); +} + +TEST_F(EventManagerTest, CountTest) { + EventManager::GetInstance().add(APIEvent(APIEvent::Type::OutputTruncated, APIEvent::Severity::Error)); + EXPECT_EQ(EventManager::GetInstance().count(), 1); +} + +int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } \ No newline at end of file