Skip to content

Commit

Permalink
Updated to Catch2 v3
Browse files Browse the repository at this point in the history
  • Loading branch information
trueqbit committed Jan 15, 2023
1 parent f776085 commit 3154d24
Show file tree
Hide file tree
Showing 130 changed files with 164 additions and 163 deletions.
8 changes: 7 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ for:
if "%appveyor_build_worker_image%"=="Visual Studio 2015" (set generator="Visual Studio 14 2015" %architecture%)
install:
- |-
cd C:\Tools\vcpkg
git clone --depth 1 --branch 2023.01.09 https://github.com/microsoft/vcpkg.git "$HOME/vcpkg"
.\bootstrap-vcpkg.bat
cd "%APPVEYOR_BUILD_FOLDER%"
C:\Tools\vcpkg\vcpkg integrate install
vcpkg install sqlite3:%platform%-windows
before_build:
Expand All @@ -121,6 +125,8 @@ for:
# using custom vcpkg triplets for building and linking dynamic dependent libraries
install:
- |-
git clone --depth 1 --branch 2023.01.09 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
$HOME/vcpkg/booststrap.sh
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
vcpkg install sqlite3 --overlay-triplets=vcpkg/triplets
before_build:
Expand All @@ -145,7 +151,7 @@ for:
# using custom vcpkg triplets for building and linking dynamic dependent libraries
install:
- |-
git clone --depth 1 --branch 2022.05.10 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
git clone --depth 1 --branch 2023.01.09 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
$HOME/vcpkg/booststrap.sh
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
vcpkg install sqlite3 --overlay-triplets=vcpkg/triplets
Expand Down
2 changes: 1 addition & 1 deletion dev/statement_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ namespace sqlite_orm {
using statement_type = conflict_clause_t;

template<class Ctx>
std::string operator()(const statement_type& statement, const Ctx& context) const {
std::string operator()(const statement_type& statement, const Ctx&) const {
switch(statement) {
case conflict_clause_t::rollback:
return "ROLLBACK";
Expand Down
6 changes: 2 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,9 @@ endif()

target_precompile_headers(unit_tests PRIVATE
<sqlite_orm/sqlite_orm.h>
<catch2/catch.hpp>)
# tests.cpp contains CATCH_CONFIG_MAIN
set_source_files_properties(tests.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
<catch2/catch_all.hpp>)

target_link_libraries(unit_tests PRIVATE sqlite_orm Catch2::Catch2)
target_link_libraries(unit_tests PRIVATE sqlite_orm Catch2::Catch2WithMain)

add_test(NAME "All_in_one_unit_test"
COMMAND unit_tests
Expand Down
2 changes: 1 addition & 1 deletion tests/ast_iterator_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/backup_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <cstdio> // remove

using namespace sqlite_orm;
Expand Down
2 changes: 1 addition & 1 deletion tests/built_in_functions_tests/core_functions_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/built_in_functions_tests/datetime_function_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/built_in_functions_tests/math_functions.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/column_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/constraints/check.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/constraints/composite_key.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/constraints/default.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/constraints/foreign_key.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include <type_traits> // std::is_same

Expand Down
8 changes: 4 additions & 4 deletions tests/constraints/unique.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

TEST_CASE("Unique") {
using Catch::Matchers::Contains;
using Catch::Matchers::ContainsSubstring;

struct Contact {
int id = 0;
Expand Down Expand Up @@ -57,11 +57,11 @@ TEST_CASE("Unique") {
storage.insert(Contact{0, "John", "Doe", "john.doe@gmail.com"});

REQUIRE_THROWS_WITH(storage.insert(Contact{0, "Johnny", "Doe", "john.doe@gmail.com"}),
Contains("constraint failed"));
ContainsSubstring("constraint failed"));

storage.insert(Shape{0, "red", "green"});
storage.insert(Shape{0, "red", "blue"});
REQUIRE_THROWS_WITH(storage.insert(Shape{0, "red", "green"}), Contains("constraint failed"));
REQUIRE_THROWS_WITH(storage.insert(Shape{0, "red", "green"}), ContainsSubstring("constraint failed"));

std::vector<List> lists(2);
REQUIRE_NOTHROW(storage.insert_range(lists.begin(), lists.end()));
Expand Down
2 changes: 1 addition & 1 deletion tests/explicit_columns.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/filename.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/get_all_custom_containers.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include <list>
#include <deque>
Expand Down
6 changes: 3 additions & 3 deletions tests/index_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down Expand Up @@ -48,7 +48,7 @@ TEST_CASE("index") {

#ifdef SQLITE_ORM_OPTIONAL_SUPPORTED
TEST_CASE("filtered index") {
using Catch::Matchers::Contains;
using Catch::Matchers::ContainsSubstring;

struct Test {
std::optional<int> field1 = 0;
Expand All @@ -62,7 +62,7 @@ TEST_CASE("filtered index") {
REQUIRE_NOTHROW(storage.sync_schema());

storage.insert(Test{1, std::nullopt});
REQUIRE_THROWS_WITH(storage.insert(Test{1, std::nullopt}), Contains("constraint failed"));
REQUIRE_THROWS_WITH(storage.insert(Test{1, std::nullopt}), ContainsSubstring("constraint failed"));
}
SECTION("2") {
auto storage = make_storage(
Expand Down
2 changes: 1 addition & 1 deletion tests/json.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/arithmetic_operators.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/between.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/binary_operators.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/bitwise.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/cast.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/glob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Obtained from here https://www.tutlane.com/tutorial/sqlite/sqlite-glob-operator
*/
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <vector> // std::vector
#include <algorithm> // std::find_if, std::count

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/in.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/is_null.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/like.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/operators/not_operator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/pointer_passing_interface.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;
using std::unique_ptr;
Expand Down
2 changes: 1 addition & 1 deletion tests/pragma_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <sqlite_orm/sqlite_orm.h>
#include <cstdio> // ::remove
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
2 changes: 1 addition & 1 deletion tests/prepared_statement_tests/column_names.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using namespace sqlite_orm;

Expand Down
8 changes: 4 additions & 4 deletions tests/prepared_statement_tests/get.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include "prepared_common.h"

using namespace sqlite_orm;

TEST_CASE("Prepared get") {
using namespace PreparedStatementTests;
using Catch::Matchers::Contains;
using Catch::Matchers::ContainsSubstring;
using Catch::Matchers::UnorderedEquals;

const int defaultVisitTime = 50;
Expand Down Expand Up @@ -72,7 +72,7 @@ TEST_CASE("Prepared get") {
}
{
get<0>(statement) = 4;
REQUIRE_THROWS_WITH(storage.execute(statement), Contains("Not found"));
REQUIRE_THROWS_WITH(storage.execute(statement), ContainsSubstring("Not found"));
}
}
}
Expand All @@ -94,7 +94,7 @@ TEST_CASE("Prepared get") {
//..
}
SECTION("execute") {
REQUIRE_THROWS_WITH(storage.execute(statement), Contains("Not found"));
REQUIRE_THROWS_WITH(storage.execute(statement), ContainsSubstring("Not found"));
}
}
{
Expand Down
2 changes: 1 addition & 1 deletion tests/prepared_statement_tests/get_all.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include "prepared_common.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/prepared_statement_tests/get_all_optional.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include "prepared_common.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/prepared_statement_tests/get_all_pointer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include "prepared_common.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/prepared_statement_tests/get_optional.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include "prepared_common.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/prepared_statement_tests/get_pointer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include "prepared_common.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/prepared_statement_tests/insert.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include "prepared_common.h"

Expand Down
6 changes: 3 additions & 3 deletions tests/prepared_statement_tests/insert_explicit.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include "prepared_common.h"

using namespace sqlite_orm;

TEST_CASE("Prepared insert explicit") {
using namespace PreparedStatementTests;
using Catch::Matchers::Contains;
using Catch::Matchers::ContainsSubstring;
using Catch::Matchers::UnorderedEquals;

const int defaultVisitTime = 50;
Expand Down Expand Up @@ -67,7 +67,7 @@ TEST_CASE("Prepared insert explicit") {
{
user.id = 6;
user.name = "Nate Dogg";
REQUIRE_THROWS_WITH(storage.execute(statement), Contains("constraint failed"));
REQUIRE_THROWS_WITH(storage.execute(statement), ContainsSubstring("constraint failed"));

get<0>(statement) = user;
auto insertedId = storage.execute(statement);
Expand Down
Loading

0 comments on commit 3154d24

Please sign in to comment.