Created main program for testing
This commit is contained in:
15
main.cpp
15
main.cpp
@@ -1,15 +1,22 @@
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include "JsonService.h"
|
||||
#include "XmlService.h"
|
||||
#include "Weather.h"
|
||||
|
||||
int main() {
|
||||
try {
|
||||
XmlService xs;
|
||||
Weather w = xs.getWeather("endpoints/weather.xml");
|
||||
std::cout << "Testing JSON Service" << std::endl;
|
||||
JsonService js;
|
||||
Weather w1 = js.getWeather("endpoints/weather.json");
|
||||
std::cout << "Weather object created (JSON)" << std::endl;
|
||||
w1.printWeather();
|
||||
|
||||
std::cout << "Weather object created" << std::endl;
|
||||
w.printWeather();
|
||||
std::cout << "\nTesting XML Service" << std::endl;
|
||||
XmlService xs;
|
||||
Weather w2 = xs.getWeather("endpoints/weather.xml");
|
||||
std::cout << "Weather object created (XML)" << std::endl;
|
||||
w2.printWeather();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error: " << e.what() << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user