blob: 6939294945a61bbfe7c18d266ddc79209b4e0cb6 [file] [log] [blame]
Zane Shelleyf685afd2021-02-15 15:39:44 -06001#include <stdio.h>
2
3#include <analyzer/service_data.hpp>
4
5#include "gtest/gtest.h"
6
7using namespace analyzer;
8
9TEST(SericeData, TestSet1)
10{
Zane Shelley64791cf2021-02-15 17:02:37 -060011 ServiceData sd{};
12
13 sd.addCallout(std::make_shared<HardwareCallout>("Test location 1",
14 Callout::Priority::HIGH));
15 sd.addCallout(std::make_shared<HardwareCallout>("Test location 2",
16 Callout::Priority::MED_A));
17 sd.addCallout(std::make_shared<ProcedureCallout>(ProcedureCallout::NEXTLVL,
18 Callout::Priority::LOW));
Zane Shelleyf685afd2021-02-15 15:39:44 -060019
20 nlohmann::json j{};
Zane Shelley64791cf2021-02-15 17:02:37 -060021 sd.getCalloutList(j);
Zane Shelleyf685afd2021-02-15 15:39:44 -060022
23 // Create a RAW string containing what we should expect in the JSON output.
24 std::string s = R"([
25 {
26 "LocationCode": "Test location 1",
27 "Priority": "H"
28 },
29 {
30 "LocationCode": "Test location 2",
31 "Priority": "A"
32 },
33 {
34 "Priority": "L",
35 "Procedure": "NEXTLVL"
36 }
37])";
38
39 ASSERT_EQ(s, j.dump(4));
40}