1515#include " bigtable/client/mutations.h"
1616#include < gmock/gmock.h>
1717#include < google/rpc/error_details.pb.h>
18+ #include " bigtable/client/testing/chrono_literals.h"
19+
20+ using namespace bigtable ::chrono_literals;
1821
1922// / @test Verify that SetCell() works as expected.
2023TEST (MutationsTest, SetCell) {
21- auto actual = bigtable::SetCell (" family" , " col" , 1234 , " value" );
24+ auto actual = bigtable::SetCell (" family" , " col" , 1234_ms , " value" );
2225 ASSERT_TRUE (actual.op .has_set_cell ());
2326 EXPECT_EQ (" family" , actual.op .set_cell ().family_name ());
2427 EXPECT_EQ (" col" , actual.op .set_cell ().column_qualifier ());
25- EXPECT_EQ (1234 , actual.op .set_cell ().timestamp_micros ());
28+ EXPECT_EQ (1234000 , actual.op .set_cell ().timestamp_micros ());
2629 EXPECT_EQ (" value" , actual.op .set_cell ().value ());
2730
2831 auto server_set = bigtable::SetCell (" fam" , " col" , " v" );
@@ -40,8 +43,8 @@ TEST(MutationsTest, SetCell) {
4043 // work around that optimization and test the move behavior.
4144 std::string val (1000000 , ' a' );
4245 auto val_data = val.data ();
43- auto moved =
44- bigtable::SetCell ( std::move (fam), std::move (col), 2345 , std::move (val));
46+ auto moved = bigtable::SetCell ( std::move (fam), std::move (col), 2345_ms,
47+ std::move (val));
4548 ASSERT_TRUE (moved.op .has_set_cell ());
4649 EXPECT_EQ (" fam2" , moved.op .set_cell ().family_name ());
4750 EXPECT_EQ (" col2" , moved.op .set_cell ().column_qualifier ());
@@ -113,7 +116,7 @@ TEST(MutationsTest, DeleteFromRow) {
113116// @test Verify that FailedMutation works as expected.
114117TEST (MutationsTest, FailedMutation) {
115118 bigtable::SingleRowMutation mut (" foo" ,
116- {bigtable::SetCell (" f" , " c" , 0 , " val" )});
119+ {bigtable::SetCell (" f" , " c" , 0_ms , " val" )});
117120
118121 // Create an overly complicated detail status, the idea is to make
119122 // sure it works in this case.
@@ -153,9 +156,9 @@ TEST(MutationsTest, MutipleRowMutations) {
153156
154157 actual
155158 .emplace_back (bigtable::SingleRowMutation (
156- " foo1" , {bigtable::SetCell (" f" , " c" , 0 , " v1" )}))
159+ " foo1" , {bigtable::SetCell (" f" , " c" , 0_ms , " v1" )}))
157160 .push_back (bigtable::SingleRowMutation (
158- " foo2" , {bigtable::SetCell (" f" , " c" , 0 , " v2" )}));
161+ " foo2" , {bigtable::SetCell (" f" , " c" , 0_ms , " v2" )}));
159162
160163 actual.MoveTo (&request);
161164 ASSERT_EQ (2 , request.entries_size ());
@@ -164,11 +167,11 @@ TEST(MutationsTest, MutipleRowMutations) {
164167
165168 std::vector<bigtable::SingleRowMutation> vec{
166169 bigtable::SingleRowMutation (" foo1" ,
167- {bigtable::SetCell (" f" , " c" , 0 , " v1" )}),
170+ {bigtable::SetCell (" f" , " c" , 0_ms , " v1" )}),
168171 bigtable::SingleRowMutation (" foo2" ,
169- {bigtable::SetCell (" f" , " c" , 0 , " v2" )}),
172+ {bigtable::SetCell (" f" , " c" , 0_ms , " v2" )}),
170173 bigtable::SingleRowMutation (" foo3" ,
171- {bigtable::SetCell (" f" , " c" , 0 , " v3" )}),
174+ {bigtable::SetCell (" f" , " c" , 0_ms , " v3" )}),
172175 };
173176 bigtable::BulkMutation from_vec (vec.begin (), vec.end ());
174177
@@ -180,9 +183,9 @@ TEST(MutationsTest, MutipleRowMutations) {
180183
181184 bigtable::BulkMutation from_il{
182185 bigtable::SingleRowMutation (" foo2" ,
183- {bigtable::SetCell (" f" , " c" , 0 , " v2" )}),
186+ {bigtable::SetCell (" f" , " c" , 0_ms , " v2" )}),
184187 bigtable::SingleRowMutation (" foo3" ,
185- {bigtable::SetCell (" f" , " c" , 0 , " v3" )}),
188+ {bigtable::SetCell (" f" , " c" , 0_ms , " v3" )}),
186189 };
187190 from_il.MoveTo (&request);
188191 ASSERT_EQ (2 , request.entries_size ());
@@ -195,8 +198,8 @@ TEST(MutationsTest, SingleRowMutationMultipleVariadic) {
195198 std::string const row_key = " row-key-1" ;
196199
197200 bigtable::SingleRowMutation actual (
198- row_key, bigtable::SetCell (" family" , " c1" , 1000 , " V1000" ),
199- bigtable::SetCell (" family" , " c2" , 2000 , " V2000" ));
201+ row_key, bigtable::SetCell (" family" , " c1" , 1_ms , " V1000" ),
202+ bigtable::SetCell (" family" , " c2" , 2_ms , " V2000" ));
200203
201204 google::bigtable::v2::MutateRowsRequest::Entry entry;
202205 (void )entry.add_mutations ();
@@ -212,7 +215,7 @@ TEST(MutationsTest, SingleRowMutationSingleVariadic) {
212215 std::string const row_key = " row-key-1" ;
213216
214217 bigtable::SingleRowMutation actual (
215- row_key, bigtable::SetCell (" family" , " c1" , 1000 , " V1000" ));
218+ row_key, bigtable::SetCell (" family" , " c1" , 1_ms , " V1000" ));
216219
217220 google::bigtable::v2::MutateRowsRequest::Entry entry;
218221 (void )entry.add_mutations ();
0 commit comments