Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit 549b9c7

Browse files
authored
Merge branch 'master' into sbromberger/fix-tests
2 parents 08a2b11 + b157b70 commit 549b9c7

File tree

5 files changed

+22
-29
lines changed

5 files changed

+22
-29
lines changed

CMakeLists.txt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cmake_policy(SET CMP0135 NEW)
1414
endif()
1515

1616
project(CLIPPy
17-
VERSION 0.2
17+
VERSION 0.5
1818
DESCRIPTION "Command Line Interface Plus Python"
1919
LANGUAGES CXX)
2020

@@ -93,25 +93,18 @@ FetchContent_MakeAvailable(Boost)
9393

9494
#
9595
# JSONLogic
96-
# find_package(jsonlogic QUIET)
97-
# if (NOT jsonlogic_FOUND)
98-
# message(STATUS "jsonlogic not found, doing stuff")
99-
set(Boost_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/boost-install) # needed for jsonlogic
100-
101-
FetchContent_Declare(jsonlogic
102-
GIT_REPOSITORY https://github.com/LLNL/jsonlogic.git
103-
GIT_TAG v0.2.0
104-
SOURCE_SUBDIR cpp
105-
)
106-
# set(jsonlogic_INCLUDE_DIR ${jsonlogic_SOURCE_DIR}/cpp/include/jsonlogic)
107-
FetchContent_MakeAvailable(jsonlogic)
108-
message(STATUS "jsonlogic source dir: ${jsonlogic_SOURCE_DIR}")
96+
set(Boost_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/boost-install) # needed for jsonlogic
10997

110-
111-
# else()
112-
# message(STATUS "jsonlogic found, weird")
98+
FetchContent_Declare(jsonlogic
99+
GIT_REPOSITORY https://github.com/LLNL/jsonlogic.git
100+
GIT_TAG v0.2.0
101+
SOURCE_SUBDIR cpp
102+
)
103+
# set(jsonlogic_INCLUDE_DIR ${jsonlogic_SOURCE_DIR}/cpp/include/jsonlogic)
104+
FetchContent_MakeAvailable(jsonlogic)
105+
message(STATUS "jsonlogic source dir: ${jsonlogic_SOURCE_DIR}")
113106

114-
# endif()
107+
115108

116109
### Require out-of-source builds
117110
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)

include/clippy/version.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

33
#define CLIPPY_VERSION_MAJOR 0
4-
#define CLIPPY_VERSION_MINOR 2
4+
#define CLIPPY_VERSION_MINOR 5
55
#define CLIPPY_VERSION_PATCH 0
6-
#define CLIPPY_VERSION_NAME "0.2.0"
6+
#define CLIPPY_VERSION_NAME "0.5.0"

test/TestBag/remove_if.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ int main(int argc, char **argv) {
3030

3131
//
3232
// Expression here
33-
auto apply_jl = [&expression](int value) {
33+
jsonlogic::logic_rule jlrule = jsonlogic::create_logic(expression["rule"]);
34+
35+
auto apply_jl = [&jlrule](int value) {
3436
boostjsn::object data;
3537
data["value"] = value;
3638
auto jl_rule_val = expression["rule"];

test/TestGraph/where.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ std::vector<testgraph::node_t> where_nodes(const testgraph::testgraph& g,
111111
});
112112

113113
return filtered_results;
114-
}
114+
}

test/TestSet/remove_if.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ int main(int argc, char **argv) {
2626
auto expression = clip.get<boostjsn::object>("expression");
2727
auto the_set = clip.get_state<std::set<int>>(state_name);
2828

29+
//
2930
//
3031
// Expression here
31-
auto apply_jl = [&expression](int value) {
32-
boostjsn::object data;
33-
data["value"] = value;
34-
auto jl_rule_val = expression["rule"];
35-
auto jlrule = jsonlogic::create_logic(jl_rule_val);
36-
auto res = jlrule.apply(jsonlogic::json_accessor(data));
37-
return jsonlogic::unpack_value<bool>(res);
32+
jsonlogic::logic_rule jlrule = jsonlogic::create_logic(expression["rule"]);
33+
34+
auto apply_jl = [&jlrule](int value) {
35+
return truthy(jlrule.apply(jsonlogic::json_accessor({{"value", value}})));
3836
};
3937

4038
for (auto first = the_set.begin(), last = the_set.end(); first != last;) {

0 commit comments

Comments
 (0)