File: cwrapper.cc

package info (click to toggle)
facter 3.11.0-2%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,576 kB
  • sloc: cpp: 22,910; python: 2,349; ruby: 936; sh: 72; makefile: 41
file content (22 lines) | stat: -rw-r--r-- 660 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <catch.hpp>
#include <facter/cwrapper.hpp>

SCENARIO("using the C wrapper function to collect default facts") {
    GIVEN("a get_default_facts invocation") {
        char *result {nullptr};

        THEN("no error should be thrown") {
            REQUIRE_NOTHROW(get_default_facts(&result));
        }

        THEN("the function execution should succeed") {
            REQUIRE(get_default_facts(&result) == 0);
        }

        THEN("the function stores the collected facts and sets the pointer arg") {
            REQUIRE(result == nullptr);
            get_default_facts(&result);
            REQUIRE_FALSE(result == nullptr);
        }
    }
}