1717#include < utility>
1818
1919#include " firebase/firestore.h"
20+ #include " firestore_integration_test.h"
21+
2022#if defined(__ANDROID__)
2123#include " firestore/src/android/document_snapshot_android.h"
2224#include " firestore/src/common/wrapper_assertions.h"
2830namespace firebase {
2931namespace firestore {
3032
31- # if defined(__ANDROID__)
33+ using DocumentSnapshotTest = FirestoreIntegrationTest;
3234
33- using DocumentSnapshotTest = testing::Test;
35+ # if defined(__ANDROID__)
3436
3537TEST_F (DocumentSnapshotTest, Construction) {
3638 testutil::AssertWrapperConstructionContract<DocumentSnapshot,
@@ -44,5 +46,27 @@ TEST_F(DocumentSnapshotTest, Assignment) {
4446
4547#endif
4648
49+ TEST_F (DocumentSnapshotTest, Equality) {
50+ DocumentReference doc1 = Collection (" col1" ).Document ();
51+ DocumentReference doc2 = Collection (" col1" ).Document ();
52+ DocumentSnapshot doc1_snap1 = ReadDocument (doc1);
53+ DocumentSnapshot doc1_snap2 = ReadDocument (doc1);
54+ DocumentSnapshot doc2_snap1 = ReadDocument (doc2);
55+ DocumentSnapshot snap3 = DocumentSnapshot ();
56+ DocumentSnapshot snap4 = DocumentSnapshot ();
57+
58+ EXPECT_TRUE (doc1_snap1 == doc1_snap1);
59+ EXPECT_TRUE (doc1_snap1 == doc1_snap2);
60+ EXPECT_TRUE (doc1_snap1 != doc2_snap1);
61+ EXPECT_TRUE (doc1_snap1 != snap3);
62+ EXPECT_TRUE (snap3 == snap4);
63+
64+ EXPECT_FALSE (doc1_snap1 != doc1_snap1);
65+ EXPECT_FALSE (doc1_snap1 != doc1_snap2);
66+ EXPECT_FALSE (doc1_snap1 == doc2_snap1);
67+ EXPECT_FALSE (doc1_snap1 == snap3);
68+ EXPECT_FALSE (snap3 != snap4);
69+ }
70+
4771} // namespace firestore
4872} // namespace firebase
0 commit comments