aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/test
diff options
context:
space:
mode:
authorGravatar zxu <zxu@google.com>2018-04-10 16:28:22 -0400
committerGravatar GitHub <noreply@github.com>2018-04-10 16:28:22 -0400
commit2ac778f312301a8dd10c3c6498a59ce536abd738 (patch)
tree68ac918167ec2e474c552f821297ade071e33a20 /Firestore/core/test
parent59f9dcb72f46258ffefea3aaf93f51e927c1cc10 (diff)
Port FieldTransform to C++ (#1033)
* port FieldMask to C++ * address changes * address changes * fix test * address change * Port transform operations (FSTTransformOperation, FSTServerTimestampTransform) to C++ * address changes * address changes * address changes * implement `FieldTransform` in C++ * port `FieldTransform` * make `fieldTransforms` shared inside `context` * address changes * fix lint * address changes
Diffstat (limited to 'Firestore/core/test')
-rw-r--r--Firestore/core/test/firebase/firestore/model/CMakeLists.txt1
-rw-r--r--Firestore/core/test/firebase/firestore/model/field_transform_test.cc39
2 files changed, 40 insertions, 0 deletions
diff --git a/Firestore/core/test/firebase/firestore/model/CMakeLists.txt b/Firestore/core/test/firebase/firestore/model/CMakeLists.txt
index 5e494f1..3bac89d 100644
--- a/Firestore/core/test/firebase/firestore/model/CMakeLists.txt
+++ b/Firestore/core/test/firebase/firestore/model/CMakeLists.txt
@@ -20,6 +20,7 @@ cc_test(
document_test.cc
field_mask_test.cc
field_path_test.cc
+ field_transform_test.cc
field_value_test.cc
maybe_document_test.cc
no_document_test.cc
diff --git a/Firestore/core/test/firebase/firestore/model/field_transform_test.cc b/Firestore/core/test/firebase/firestore/model/field_transform_test.cc
new file mode 100644
index 0000000..b66aeef
--- /dev/null
+++ b/Firestore/core/test/firebase/firestore/model/field_transform_test.cc
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2018 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Firestore/core/src/firebase/firestore/model/field_transform.h"
+#include "Firestore/core/src/firebase/firestore/model/transform_operations.h"
+#include "Firestore/core/test/firebase/firestore/testutil/testutil.h"
+
+#include "absl/memory/memory.h"
+#include "gtest/gtest.h"
+
+namespace firebase {
+namespace firestore {
+namespace model {
+
+TEST(FieldTransform, Getter) {
+ FieldTransform transform(testutil::Field("foo"),
+ absl::make_unique<ServerTimestampTransform>(
+ ServerTimestampTransform::Get()));
+
+ EXPECT_EQ(testutil::Field("foo"), transform.path());
+ EXPECT_EQ(ServerTimestampTransform::Get(), transform.transformation());
+}
+
+} // namespace model
+} // namespace firestore
+} // namespace firebase