Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Test_PanoLog.cpp File Reference
#include "gtest/gtest.h"
#include "pano_log.h"
#include <filesystem>
#include <fstream>

Go to the source code of this file.

Classes

class  LogFolder

Functions

 TEST_F (LogFolder, EmptyFolderStartsAtZero)
 TEST_F (LogFolder, MissingFolderStartsAtZero)
 TEST_F (LogFolder, OnlyTheFirstFile)
 TEST_F (LogFolder, HighestNumberNotLastAlphabetically)
 TEST_F (LogFolder, OtherNamesAreIgnored)
 TEST_F (LogFolder, CaseInsensitive)

Function Documentation

◆ TEST_F() [1/6]

TEST_F ( LogFolder ,
CaseInsensitive  )

Definition at line 60 of file Test_PanoLog.cpp.

60 {
61 Touch(L"PANO4.LOG");
62 EXPECT_EQ(Newest(), 4u);
63}

◆ TEST_F() [2/6]

TEST_F ( LogFolder ,
EmptyFolderStartsAtZero  )

Definition at line 29 of file Test_PanoLog.cpp.

29 {
30 EXPECT_EQ(Newest(), 0u);
31}

◆ TEST_F() [3/6]

TEST_F ( LogFolder ,
HighestNumberNotLastAlphabetically  )

Definition at line 42 of file Test_PanoLog.cpp.

42 {
43 Touch(L"pano.log");
44 Touch(L"pano1.log");
45 Touch(L"pano2.log");
46 Touch(L"pano10.log");
47 EXPECT_EQ(Newest(), 10u);
48}

◆ TEST_F() [4/6]

TEST_F ( LogFolder ,
MissingFolderStartsAtZero  )

Definition at line 33 of file Test_PanoLog.cpp.

33 {
34 EXPECT_EQ(NewestLogFileNumber(m_folder.wstring() + L"\\missing\\", L"pano", L".log"), 0u);
35}
DWORD NewestLogFileNumber(const std::wstring &folder, const std::wstring &base, const std::wstring &ext)
The number of the newest log file in a folder: 0 for base.ext (or when there is none),...
Definition pano_log.cpp:33

References NewestLogFileNumber().

◆ TEST_F() [5/6]

TEST_F ( LogFolder ,
OnlyTheFirstFile  )

Definition at line 37 of file Test_PanoLog.cpp.

37 {
38 Touch(L"pano.log");
39 EXPECT_EQ(Newest(), 0u);
40}

◆ TEST_F() [6/6]

TEST_F ( LogFolder ,
OtherNamesAreIgnored  )

Definition at line 50 of file Test_PanoLog.cpp.

50 {
51 Touch(L"pano3.log");
52 Touch(L"pano99.log.bak");
53 Touch(L"panoX7.log");
54 Touch(L"pano.old.log");
55 Touch(L"detection50.log");
56 Touch(L"pano12345678901.log"); // too many digits for a file number
57 EXPECT_EQ(Newest(), 3u);
58}