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 | { |
| 11 | HardwareCallout c1{"Test location 1", Callout::Priority::HIGH}; |
| 12 | HardwareCallout c2{"Test location 2", Callout::Priority::MED_A}; |
| 13 | ProcedureCallout c3{ProcedureCallout::NEXTLVL, Callout::Priority::LOW}; |
| 14 | |
| 15 | nlohmann::json j{}; |
| 16 | |
| 17 | c1.getJson(j); |
| 18 | c2.getJson(j); |
| 19 | c3.getJson(j); |
| 20 | |
| 21 | // Create a RAW string containing what we should expect in the JSON output. |
| 22 | std::string s = R"([ |
| 23 | { |
| 24 | "LocationCode": "Test location 1", |
| 25 | "Priority": "H" |
| 26 | }, |
| 27 | { |
| 28 | "LocationCode": "Test location 2", |
| 29 | "Priority": "A" |
| 30 | }, |
| 31 | { |
| 32 | "Priority": "L", |
| 33 | "Procedure": "NEXTLVL" |
| 34 | } |
| 35 | ])"; |
| 36 | |
| 37 | ASSERT_EQ(s, j.dump(4)); |
| 38 | } |