Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | |
| 3 | #include <analyzer/service_data.hpp> |
| 4 | |
| 5 | #include "gtest/gtest.h" |
| 6 | |
| 7 | using namespace analyzer; |
| 8 | |
| 9 | TEST(SericeData, TestSet1) |
| 10 | { |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 11 | 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 Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 19 | |
| 20 | nlohmann::json j{}; |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 21 | sd.getCalloutList(j); |
Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 22 | |
| 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 | } |