From 4d7d3ee589b65fdf511e74be33903c099de7f686 Mon Sep 17 00:00:00 2001 From: "Jorge C. Leitao" Date: Tue, 31 Aug 2021 07:00:51 +0000 Subject: [PATCH] Added some tests. --- tests/it/array/primitive/mod.rs | 38 ++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/tests/it/array/primitive/mod.rs b/tests/it/array/primitive/mod.rs index 57173a6415e..0dc9cab6ffc 100644 --- a/tests/it/array/primitive/mod.rs +++ b/tests/it/array/primitive/mod.rs @@ -1,6 +1,12 @@ -use arrow2::{array::*, bitmap::Bitmap, datatypes::*, types::days_ms}; use std::iter::FromIterator; +use arrow2::{ + array::*, + bitmap::Bitmap, + datatypes::*, + types::{days_ms, months_days_ns}, +}; + mod mutable; #[test] @@ -220,3 +226,33 @@ fn display_interval_days_ms() { let array = DaysMsArray::from(&[Some(days_ms::new(1, 1)), None, Some(days_ms::new(2, 2))]); assert_eq!(format!("{}", array), "Interval(DayTime)[1d1ms, , 2d2ms]"); } + +#[test] +fn display_months_days_ns() { + let data = &[ + Some(months_days_ns::new(1, 1, 2)), + None, + Some(months_days_ns::new(2, 3, 3)), + ]; + + let array = MonthsDaysNsArray::from(&data); + + assert_eq!( + format!("{}", array), + "Interval(MonthDayNano)[1m1d2ns, , 2m3d3ns]" + ); +} + +#[test] +fn months_days_ns() { + let data = &[ + months_days_ns::new(1, 1, 2), + months_days_ns::new(1, 1, 3), + months_days_ns::new(2, 3, 3), + ]; + + let array = MonthsDaysNsArray::from_slice(&data); + + let a = array.values().as_slice(); + assert_eq!(a, data.as_ref()); +}