Chengyu Fan | eb0422c | 2015-03-04 16:34:14 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2015, Colorado State University. |
| 4 | * |
| 5 | * This file is part of ndn-atmos. |
| 6 | * |
| 7 | * ndn-atmos is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-atmos is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-atmos, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-atmos authors and contributors. |
| 20 | */ |
| 21 | |
| 22 | #include <boost/test/unit_test.hpp> |
Chengyu Fan | 8b92f12 | 2015-03-09 22:13:36 -0600 | [diff] [blame] | 23 | #include <json/value.h> |
| 24 | #include <json/writer.h> |
| 25 | #include <json/reader.h> |
Chengyu Fan | 2788755 | 2015-03-26 17:12:00 -0600 | [diff] [blame^] | 26 | #include <mysql.h> |
Chengyu Fan | 8b92f12 | 2015-03-09 22:13:36 -0600 | [diff] [blame] | 27 | #include <iostream> |
Chengyu Fan | eb0422c | 2015-03-04 16:34:14 -0700 | [diff] [blame] | 28 | |
| 29 | namespace NdnAtmos { |
| 30 | namespace test { |
| 31 | |
| 32 | BOOST_AUTO_TEST_SUITE(MasterSuite) |
| 33 | |
| 34 | BOOST_AUTO_TEST_CASE(SimpleTest) |
| 35 | { |
| 36 | BOOST_CHECK(0==0); |
| 37 | } |
| 38 | |
Chengyu Fan | 8b92f12 | 2015-03-09 22:13:36 -0600 | [diff] [blame] | 39 | BOOST_AUTO_TEST_CASE(DBTest) |
| 40 | { |
Chengyu Fan | 2788755 | 2015-03-26 17:12:00 -0600 | [diff] [blame^] | 41 | MYSQL *conn = mysql_init(NULL); |
| 42 | BOOST_CHECK_EQUAL(conn == NULL, false); |
Chengyu Fan | 8b92f12 | 2015-03-09 22:13:36 -0600 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | BOOST_AUTO_TEST_CASE(JsonTest) |
| 46 | { |
| 47 | Json::Value original; |
| 48 | original["command"] = "test"; |
| 49 | |
| 50 | Json::FastWriter fastWriter; |
| 51 | std::string jsonMessage = fastWriter.write(original); |
| 52 | |
| 53 | Json::Value parsedFromString; |
| 54 | Json::Reader reader; |
| 55 | bool result; |
| 56 | BOOST_CHECK_EQUAL(result = reader.parse(jsonMessage, parsedFromString), true); |
| 57 | if (result) { |
| 58 | BOOST_CHECK_EQUAL(original, parsedFromString); |
| 59 | } |
| 60 | } |
| 61 | |
Chengyu Fan | eb0422c | 2015-03-04 16:34:14 -0700 | [diff] [blame] | 62 | BOOST_AUTO_TEST_SUITE_END() |
| 63 | |
| 64 | } //namespace test |
| 65 | } //namespace ndn-atmos |