Skip to content

Commit

Permalink
add update&replace ut
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacyking committed Dec 14, 2023
1 parent 1466d33 commit b281b05
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_ormpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ TEST_CASE("update replace") {
if (mysql.connect(ip, username, password, db)) {
mysql.execute("drop table if exists person");
mysql.create_datatable<person>(ormpp_auto_key{"id"});
mysql.insert<person>({"purecpp", 100, 1});
mysql.insert<person>({"purecpp", 100});
auto vec = mysql.query<person>();
CHECK(vec.size() == 1);
vec.front().name = "update";
Expand All @@ -510,7 +510,7 @@ TEST_CASE("update replace") {
CHECK(vec.size() == 1);
CHECK(vec.front().name == "update");
CHECK(vec.front().age == 200);
mysql.update<person>({"purecpp", 100}, "id=1");
mysql.update<person>({"purecpp", 100, 1}, "id=1");
vec = mysql.query<person>();
CHECK(vec.size() == 1);
CHECK(vec.front().name == "purecpp");
Expand All @@ -529,7 +529,7 @@ TEST_CASE("update replace") {
if (postgres.connect(ip, username, password, db)) {
postgres.execute("drop table if exists person");
postgres.create_datatable<person>(ormpp_auto_key{"id"});
postgres.insert<person>({"purecpp", 100, 1});
postgres.insert<person>({"purecpp", 100});
auto vec = postgres.query<person>();
CHECK(vec.size() == 1);
vec.front().name = "update";
Expand All @@ -539,7 +539,7 @@ TEST_CASE("update replace") {
CHECK(vec.size() == 1);
CHECK(vec.front().name == "update");
CHECK(vec.front().age == 200);
postgres.update<person>({"purecpp", 100}, "id=1");
postgres.update<person>({"purecpp", 100, 1}, "id=1");
vec = postgres.query<person>();
CHECK(vec.size() == 1);
CHECK(vec.front().name == "purecpp");
Expand All @@ -563,7 +563,7 @@ TEST_CASE("update replace") {
if (sqlite.connect(db)) {
sqlite.execute("drop table if exists person");
sqlite.create_datatable<person>(ormpp_auto_key{"id"});
sqlite.insert<person>({"purecpp", 100, 1});
sqlite.insert<person>({"purecpp", 100});
auto vec = sqlite.query<person>();
CHECK(vec.size() == 1);
vec.front().name = "update";
Expand All @@ -573,7 +573,7 @@ TEST_CASE("update replace") {
CHECK(vec.size() == 1);
CHECK(vec.front().name == "update");
CHECK(vec.front().age == 200);
sqlite.update<person>({"purecpp", 100}, "id=1");
sqlite.update<person>({"purecpp", 100, 1}, "id=1");
vec = sqlite.query<person>();
CHECK(vec.size() == 1);
CHECK(vec.front().name == "purecpp");
Expand Down

0 comments on commit b281b05

Please sign in to comment.