blob: 970b8350ee7c50def554ba3cfeeb4700dbc901ea [file] [log] [blame]
Chengyu Faneb0422c2015-03-04 16:34:14 -07001/* -*- 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 Fan8b92f122015-03-09 22:13:36 -060023#include <json/value.h>
24#include <json/writer.h>
25#include <json/reader.h>
Chengyu Fan27887552015-03-26 17:12:00 -060026#include <mysql.h>
Chengyu Fan8b92f122015-03-09 22:13:36 -060027#include <iostream>
Chengyu Faneb0422c2015-03-04 16:34:14 -070028
29namespace NdnAtmos {
30namespace test {
31
32BOOST_AUTO_TEST_SUITE(MasterSuite)
33
34BOOST_AUTO_TEST_CASE(SimpleTest)
35{
36 BOOST_CHECK(0==0);
37}
38
Chengyu Fan8b92f122015-03-09 22:13:36 -060039BOOST_AUTO_TEST_CASE(DBTest)
40{
Chengyu Fan27887552015-03-26 17:12:00 -060041 MYSQL *conn = mysql_init(NULL);
42 BOOST_CHECK_EQUAL(conn == NULL, false);
Chengyu Fan8b92f122015-03-09 22:13:36 -060043}
44
45BOOST_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 Faneb0422c2015-03-04 16:34:14 -070062BOOST_AUTO_TEST_SUITE_END()
63
64} //namespace test
65} //namespace ndn-atmos