@@ -208,6 +208,93 @@ TEST_F(DataTypeIntegrationTest, WriteReadDate) {
208208 EXPECT_THAT (*result, UnorderedElementsAreArray (data));
209209}
210210
211+ TEST_F (DataTypeIntegrationTest, WriteReadArrayBool) {
212+ std::vector<std::vector<bool >> const data = {
213+ std::vector<bool >{},
214+ std::vector<bool >{true },
215+ std::vector<bool >{false },
216+ std::vector<bool >{true , false },
217+ std::vector<bool >{false , true },
218+ };
219+ auto result = WriteReadData (*client_, data, " ArrayBoolValue" );
220+ ASSERT_STATUS_OK (result);
221+ EXPECT_THAT (*result, UnorderedElementsAreArray (data));
222+ }
223+
224+ TEST_F (DataTypeIntegrationTest, WriteReadArrayInt64) {
225+ std::vector<std::vector<std::int64_t >> const data = {
226+ std::vector<std::int64_t >{},
227+ std::vector<std::int64_t >{-1 },
228+ std::vector<std::int64_t >{-1 , 0 , 1 },
229+ };
230+ auto result = WriteReadData (*client_, data, " ArrayInt64Value" );
231+ ASSERT_STATUS_OK (result);
232+ EXPECT_THAT (*result, UnorderedElementsAreArray (data));
233+ }
234+
235+ TEST_F (DataTypeIntegrationTest, WriteReadArrayFloat64) {
236+ std::vector<std::vector<double >> const data = {
237+ std::vector<double >{},
238+ std::vector<double >{-0.5 },
239+ std::vector<double >{-0.5 , 0.5 , 1.5 },
240+ };
241+ auto result = WriteReadData (*client_, data, " ArrayFloat64Value" );
242+ ASSERT_STATUS_OK (result);
243+ EXPECT_THAT (*result, UnorderedElementsAreArray (data));
244+ }
245+
246+ TEST_F (DataTypeIntegrationTest, WriteReadArrayString) {
247+ std::vector<std::vector<std::string>> const data = {
248+ std::vector<std::string>{},
249+ std::vector<std::string>{" " },
250+ std::vector<std::string>{" " , " foo" , " bar" },
251+ };
252+ auto result = WriteReadData (*client_, data, " ArrayStringValue" );
253+ ASSERT_STATUS_OK (result);
254+ EXPECT_THAT (*result, UnorderedElementsAreArray (data));
255+ }
256+
257+ TEST_F (DataTypeIntegrationTest, WriteReadArrayBytes) {
258+ std::vector<std::vector<Bytes>> const data = {
259+ std::vector<Bytes>{},
260+ std::vector<Bytes>{Bytes (" " )},
261+ std::vector<Bytes>{Bytes (" " ), Bytes (" foo" ), Bytes (" bar" )},
262+ };
263+ auto result = WriteReadData (*client_, data, " ArrayBytesValue" );
264+ ASSERT_STATUS_OK (result);
265+ EXPECT_THAT (*result, UnorderedElementsAreArray (data));
266+ }
267+
268+ TEST_F (DataTypeIntegrationTest, WriteReadArrayTimestamp) {
269+ std::vector<std::vector<Timestamp>> const data = {
270+ std::vector<Timestamp>{},
271+ std::vector<Timestamp>{Timestamp (std::chrono::seconds (-1 ))},
272+ std::vector<Timestamp>{
273+ Timestamp (std::chrono::seconds (-1 )),
274+ Timestamp (),
275+ Timestamp (std::chrono::seconds (1 )),
276+ },
277+ };
278+ auto result = WriteReadData (*client_, data, " ArrayTimestampValue" );
279+ ASSERT_STATUS_OK (result);
280+ EXPECT_THAT (*result, UnorderedElementsAreArray (data));
281+ }
282+
283+ TEST_F (DataTypeIntegrationTest, WriteReadArrayDate) {
284+ std::vector<std::vector<Date>> const data = {
285+ std::vector<Date>{},
286+ std::vector<Date>{Date ()},
287+ std::vector<Date>{
288+ Date (1 , 1 , 1 ),
289+ Date (),
290+ Date (9999 , 12 , 31 ),
291+ },
292+ };
293+ auto result = WriteReadData (*client_, data, " ArrayDateValue" );
294+ ASSERT_STATUS_OK (result);
295+ EXPECT_THAT (*result, UnorderedElementsAreArray (data));
296+ }
297+
211298} // namespace
212299} // namespace SPANNER_CLIENT_NS
213300} // namespace spanner
0 commit comments