SHARE
TWEET

Untitled

a guest Sep 21st, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. std::string json = <json-строка из примера выше>;
  2.  
  3. Json object = Json::parse(json);
  4. EXPECT_EQ(std::any_cast<std::string>(object["lastname"]), "Ivanov");
  5. EXPECT_EQ(std::any_cast<bool>(object["islegal"]), false);
  6. EXPECT_EQ(std::any_cast<int>(object["age"]), 25);
  7.  
  8. auto marks = std::any_cast<Json>(object["marks"]);
  9. EXPECT_EQ(std::any_cast<int>(marks[0]), 4);
  10. EXPECT_EQ(std::any_cast<int>(marks[1]), 5);
  11.  
  12. auto address = std::any_cast<Json>(object["address"]);
  13. EXPECT_EQ(std::any_cast<std::string>(address["city"]), "Moscow");
  14. EXPECT_EQ(std::any_cast<std::string>(address["street"]), "Vozdvijenka");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top