Commit 16fa85e9 authored by Niels's avatar Niels

Zwischenstand

parent a5188b08
...@@ -48,3 +48,4 @@ libjson.a ...@@ -48,3 +48,4 @@ libjson.a
Testing Testing
.idea .idea
utf8_test
The library is licensed under the MIT License The library is licensed under the MIT License
<http://opensource.org/licenses/MIT>: <http://opensource.org/licenses/MIT>:
Copyright (c) 2013-2014 Niels Lohmann Copyright (c) 2013-2015 Niels Lohmann
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in
......
...@@ -4,12 +4,20 @@ noinst_PROGRAMS = json_unit ...@@ -4,12 +4,20 @@ noinst_PROGRAMS = json_unit
FLAGS = -Wall -Wextra -pedantic -Weffc++ -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch -Wundef -Wno-unused -Wnon-virtual-dtor -Wreorder FLAGS = -Wall -Wextra -pedantic -Weffc++ -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch -Wundef -Wno-unused -Wnon-virtual-dtor -Wreorder
json_unit_SOURCES = $(CORE_SOURCES) test/catch.hpp test/unit.cpp src/json.hpp json_unit_SOURCES = src/json.hpp test/catch.hpp test/unit.cpp
json_unit_CXXFLAGS = $(FLAGS) -std=c++11 json_unit_CXXFLAGS = $(FLAGS) -std=c++11
json_unit_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/test -Dprivate=public json_unit_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/test -Dprivate=public
# parameters:
# -b use bit vectors
# -s nested ifs
# -i do not create #line information
# --no-generation-date suppress generation date output
src/json.hpp: src/json.hpp.re2c
$(AM_V_GEN)$(RE2C) -b -s -i --no-generation-date $< | $(SED) '1d' > $@
cppcheck: cppcheck:
cppcheck --enable=all --inconclusive --std=c++11 src/json.* cppcheck --enable=all --inconclusive --std=c++11 src/json.hpp
svn-clean: maintainer-clean svn-clean: maintainer-clean
rm -fr configure INSTALL aclocal.m4 build-aux depcomp install-sh missing test-driver rm -fr configure INSTALL aclocal.m4 build-aux depcomp install-sh missing test-driver
...@@ -21,4 +29,4 @@ pretty: ...@@ -21,4 +29,4 @@ pretty:
--indent-col1-comments --pad-oper --pad-header --align-pointer=type \ --indent-col1-comments --pad-oper --pad-header --align-pointer=type \
--align-reference=type --add-brackets --convert-tabs --close-templates \ --align-reference=type --add-brackets --convert-tabs --close-templates \
--lineend=linux --preserve-date --suffix=none \ --lineend=linux --preserve-date --suffix=none \
$(SOURCES) src/json.hpp src/json.hpp.re2c test/unit.cpp
AC_INIT([JSON], [3.0], [mail@nlohmann.me]) AC_INIT([JSON], [3.0], [mail@nlohmann.me])
AC_CONFIG_SRCDIR([src/json.hpp]) AC_CONFIG_SRCDIR([src/json.hpp.re2c])
AM_INIT_AUTOMAKE([foreign subdir-objects]) AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
AC_PROG_CXX AC_PROG_CXX
AC_PROG_SED
AC_PATH_PROG(RE2C, [re2c])
AM_MISSING_PROG(CPPCHECK, [cppcheck])
AM_MISSING_PROG(ASTYLE, [astyle])
AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(Makefile)
AC_OUTPUT AC_OUTPUT
This diff is collapsed.
This diff is collapsed.
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
using nlohmann::json; using nlohmann::json;
TEST_CASE()
{
CHECK(json::parser("[1,2,3,4,5,6]").parse().dump() == "[1,2,3,4,5,6]");
}
TEST_CASE() TEST_CASE()
{ {
CHECK(json::escape_string("\\") == "\\\\"); CHECK(json::escape_string("\\") == "\\\\");
...@@ -19,6 +24,12 @@ TEST_CASE() ...@@ -19,6 +24,12 @@ TEST_CASE()
CHECK(json::escape_string("\b") == "\\b"); CHECK(json::escape_string("\b") == "\\b");
CHECK(json::escape_string("\t") == "\\t"); CHECK(json::escape_string("\t") == "\\t");
CHECK(json::escape_string("Lorem ipsum \"dolor\" sit amet,\nconsectetur \\ adipiscing elit.")
== "Lorem ipsum \\\"dolor\\\" sit amet,\\nconsectetur \\\\ adipiscing elit.");
CHECK(json::escape_string("the main said, \"cool!\"") == "the main said, \\\"cool!\\\"");
CHECK(json::escape_string("\a") == "\\u0007");
CHECK(json::escape_string("\v") == "\\u000b");
{ {
json j = "AC/DC"; json j = "AC/DC";
CHECK(j.dump() == "\"AC/DC\""); CHECK(j.dump() == "\"AC/DC\"");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment