Skip to content

Commit

Permalink
Close #13; Add ODR test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeaye committed Mar 25, 2015
1 parent 39bf7f6 commit e277be8
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 7 deletions.
8 changes: 7 additions & 1 deletion Makefile.in
Expand Up @@ -3,7 +3,8 @@ OUT_DIR = bin/
SOURCES = \
test/src/map/main.cpp \
test/src/array/main.cpp \
test/src/parser/main.cpp
test/src/parser/main.cpp \
test/src/odr/main.cpp
OBJECTS = ${SOURCES:.cpp=.cpp.o}
TEST_OBJECTS = $(SOURCES:.cpp=.test)
TESTS = $(foreach test,${SOURCES}, $(addprefix ${OUT_DIR}, $(notdir $(test))))
Expand Down Expand Up @@ -62,6 +63,11 @@ ${PROJECT}_setup: setup
mkdir -p ${OUT_DIR}$(dir $(shell echo $< | sed 's_test/src/__')) > /dev/null
${CXX} ${CXX_FLAGS} $< ${LD_LIBS} -o ${OUT_DIR}$(shell echo "$(shell echo $< | sed 's/\.cpp//')" | sed 's_test/src/__') > /dev/null

test/src/odr/main.cpp.o: ${PROJECT}_setup
echo " Validating ODR"
mkdir -p ${OUT_DIR}$(dir $(shell echo test/src/odr/main.cpp | sed 's_test/src/__')) > /dev/null
${CXX} ${CXX_FLAGS} test/src/odr/main1.cpp test/src/odr/main2.cpp ${LD_LIBS} -o ${OUT_DIR}$(shell echo "$(shell echo test/src/odr/main.cpp | sed 's/\.cpp//')" | sed 's_test/src/__') > /dev/null

install:
export installdir=${DESTDIR}${INCLUDEDIR} && \
export project=${PROJECT} && \
Expand Down
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -17,7 +17,7 @@ it expects valid JSON all of the time.

Practice
----
Assuming the JeayeSON headers are in your search path, simply
Assuming the JeayeSON headers are in your search path, simply
```cpp
#include <jeayeson/jeayeson.hpp>
```
Expand Down Expand Up @@ -108,15 +108,15 @@ std::cout << std::endl;
```
### Installation
The `./configure` script must be used at least once to automagically generate `jeayeson/config.hpp` (see [Customization](https://github.com/jeaye/jeayeson#customization)). Since JeayeSON is a header-only library, simply copy over the contents of `include` to your project, or, better yet, add JeayeSON as a submodule and introduce `jeayeson/include` to your header search paths.
The `./configure` script must be used at least once to automagically generate `jeayeson/config.hpp` (see [Customization](https://github.com/jeaye/jeayeson#customization)). Since JeayeSON is a header-only library, simply copy over the contents of `include` to your project, or, better yet, add JeayeSON as a submodule and introduce `jeayeson/include` to your header search paths
A full installation can also be achieved by using `./configure && make install`. See the `./configure` script for prefix options.
A full installation can also be achieved by using `./configure && make install`. See the `./configure` script for prefix options.
Customization
---
**NOTE**: All configuration is easily done in `jeayeson/config.hpp`, which is generated when you run `./configure` (and is not overwritten subsequently -- delete it to reset).
Customization can be achieved by adjusting the types in the `jeayeson::config` struct template. A specialization is already provided, which contains the default types used by JeayeSON. Feel free to change the types to any other, still compatible, types.
Customization can be achieved by adjusting the types in the `jeayeson::config` struct template. A specialization is already provided, which contains the default types used by JeayeSON. Feel free to change the types to any other, still compatible, types.
For example, you may want the json integer type to be 32bit instead of the default 64bit. Or, you may want to use `std::unordered_map` instead of `std::map`.
Expand All @@ -131,7 +131,7 @@ $ ./configure && make
# Depending on your compiler setup (gcc or clang, linux or osx, etc)
# you may need to specify some extra flags. An example case:
# (allows clang & libc++ to work on Arch Linux)
$ CXX=clang++ CXX_FLAGS=-stdlib=libc++ LD_LIBS=-lc++abi make
$ CXX=clang++ CXX_FLAGS=-stdlib=libc++ LD_LIBS=-lc++abi make
```
Once built, you can run the tests:
```bash
Expand Down
2 changes: 1 addition & 1 deletion lib/jest
17 changes: 17 additions & 0 deletions test/src/odr/main1.cpp
@@ -0,0 +1,17 @@
/*
Copyright © 2015 Jesse 'Jeaye' Wilkerson
See licensing at:
http://opensource.org/licenses/BSD-3-Clause
File: test/src/odr/main1.cpp
Author: Jesse 'Jeaye' Wilkerson
*/

#include <jeayeson/jeayeson.hpp>
#include <jest/jest.hpp>

int main()
{
jest::worker const j{};
return j();
}
11 changes: 11 additions & 0 deletions test/src/odr/main2.cpp
@@ -0,0 +1,11 @@
/*
Copyright © 2015 Jesse 'Jeaye' Wilkerson
See licensing at:
http://opensource.org/licenses/BSD-3-Clause
File: test/src/odr/main2.cpp
Author: Jesse 'Jeaye' Wilkerson
*/

#include <jeayeson/jeayeson.hpp>
#include <jest/jest.hpp>

0 comments on commit e277be8

Please sign in to comment.