blob: 01ae66ac82346c6db6f121c9aca3117d9eb37404 [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 <libpq-fe.h>
24#include <json/value.h>
25#include <json/writer.h>
26#include <json/reader.h>
27#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{
41 PGconn *conn;
42 conn = PQconnectdb("dbname=test sslmode=disable");
43 BOOST_CHECK_EQUAL(PQstatus(conn) != CONNECTION_OK, true);
44}
45
46BOOST_AUTO_TEST_CASE(JsonTest)
47{
48 Json::Value original;
49 original["command"] = "test";
50
51 Json::FastWriter fastWriter;
52 std::string jsonMessage = fastWriter.write(original);
53
54 Json::Value parsedFromString;
55 Json::Reader reader;
56 bool result;
57 BOOST_CHECK_EQUAL(result = reader.parse(jsonMessage, parsedFromString), true);
58 if (result) {
59 BOOST_CHECK_EQUAL(original, parsedFromString);
60 }
61}
62
Chengyu Faneb0422c2015-03-04 16:34:14 -070063BOOST_AUTO_TEST_SUITE_END()
64
65} //namespace test
66} //namespace ndn-atmos