Created main program for testing

This commit is contained in:
2026-04-21 10:51:42 +03:00
parent a9b258ceb3
commit bde893a905

View File

@@ -1,15 +1,22 @@
#include <iostream> #include <iostream>
#include <exception> #include <exception>
#include "JsonService.h"
#include "XmlService.h" #include "XmlService.h"
#include "Weather.h" #include "Weather.h"
int main() { int main() {
try { try {
XmlService xs; std::cout << "Testing JSON Service" << std::endl;
Weather w = xs.getWeather("endpoints/weather.xml"); 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; std::cout << "\nTesting XML Service" << std::endl;
w.printWeather(); XmlService xs;
Weather w2 = xs.getWeather("endpoints/weather.xml");
std::cout << "Weather object created (XML)" << std::endl;
w2.printWeather();
} }
catch (const std::exception& e) { catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl; std::cerr << "Error: " << e.what() << std::endl;