File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,15 @@ FetchContent_Declare(
19
19
20
20
FetchContent_MakeAvailable (Catch2 cpprealm )
21
21
22
- # add_executable(examples testHelpers.hpp testHelpersTests.cpp authentication.cpp define-object-model.cpp examples.cpp flexible-sync.cpp supported-types.cpp)
23
- add_executable (examples authentication.cpp define-object-model.cpp examples.cpp filter -data.cpp flexible-sync.cpp quick-start.cpp supported-types.cpp )
22
+ add_executable (examples
23
+ authentication.cpp
24
+ define-object-model.cpp
25
+ examples.cpp
26
+ filter -data.cpp
27
+ flexible-sync.cpp
28
+ quick-start.cpp
29
+ supported-types.cpp
30
+ )
24
31
25
32
target_link_libraries (examples PRIVATE Catch2::Catch2WithMain )
26
33
target_link_libraries (examples PRIVATE cpprealm )
Original file line number Diff line number Diff line change 1
1
#include < catch2/catch_test_macros.hpp>
2
- // #include <string>
3
2
#include < thread>
4
3
#include < future>
5
4
#include < string>
6
- #include < unistd.h>
7
5
// :snippet-start: includes
8
6
#include < cpprealm/sdk.hpp>
9
7
// :snippet-end:
12
10
// "terms": {
13
11
// "Local_": "",
14
12
// "Sync_": "",
15
- // "charUserId ": "userId"
13
+ // "userId.c_str() ": "userId"
16
14
// }
17
15
// }
18
16
@@ -122,7 +120,7 @@ TEST_CASE("sync quick start", "[realm][write][sync]") {
122
120
auto realm = synced_realm_ref.resolve ();
123
121
// :remove-start:
124
122
// Remove any existing subscriptions before adding the one for this example
125
- auto clearInitialSubscriptions = realm.subscriptions ().update ([](realm::mutable_sync_subscription_set &subs) {
123
+ auto clearInitialSubscriptions = realm.subscriptions ().update ([](auto &subs) {
126
124
subs.clear ();
127
125
}).get_future ().get ();
128
126
CHECK (clearInitialSubscriptions == true );
@@ -144,13 +142,11 @@ TEST_CASE("sync quick start", "[realm][write][sync]") {
144
142
// The C++ SDK is currently missing a constructor to store a std::string
145
143
// So convert the userId std::string to a character array for persisting.
146
144
// TODO: Remove this and use the userId directly when the constructor is added.
147
- char * charUserId = strcpy (new char [userId.length () + 1 ], userId.c_str ());
148
-
149
145
// :snippet-start: write-to-synced-realm
150
146
auto todo = Sync_Todo {
151
147
.name = " Create a Sync todo item" ,
152
148
.status = " In Progress" ,
153
- .ownerId = charUserId
149
+ .ownerId = userId. c_str ()
154
150
};
155
151
156
152
realm.write ([&realm, &todo] {
You can’t perform that action at this time.
0 commit comments