Skip to content

Commit b360ff9

Browse files
committed
test: added syslogd unit test cases
1 parent 9fe9e75 commit b360ff9

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cmake_minimum_required(VERSION 2.8.9)
22
project(unittests C CXX)
3+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
34

45
option(COVERAGE "Build with coverage generation" OFF)
56
option(SILENT_BUILD "Build with some warnings turned off" ON)
@@ -85,6 +86,7 @@ set(TEST_SOURCES
8586
${TEST}/util/unit/percent_encoding_test.cpp
8687
${TEST}/util/unit/ringbuffer.cpp
8788
${TEST}/util/unit/statman.cpp
89+
${TEST}/util/unit/syslogd_test.cpp
8890
${TEST}/util/unit/tar_test.cpp
8991
${TEST}/util/unit/uri_test.cpp
9092
)

test/util/unit/syslogd_test.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// This file is a part of the IncludeOS unikernel - www.includeos.org
2+
//
3+
// Copyright 2015-2017 Oslo and Akershus University College of Applied Sciences
4+
// and Alfred Bratterud
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
18+
#include <common.cxx>
19+
#include <syslog.h>
20+
#include <util/syslogd.hpp>
21+
22+
CASE("valid_priority() returns whether supplied priority is valid")
23+
{
24+
EXPECT(Syslog::valid_priority(LOG_EMERG) == true);
25+
EXPECT(Syslog::valid_priority(LOG_DEBUG) == true);
26+
EXPECT_NOT(Syslog::valid_priority(8192007) == true);
27+
}

0 commit comments

Comments
 (0)