// Copyright (c) 2019, Bayu Aldi Yansyah // // 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. extern crate gulali; use gulali::prelude::*; #[test] fn test_zeros_u8_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_u8_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_u8_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_u8_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_u16_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_u16_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_u16_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_u16_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_u32_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_u32_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_u32_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_u32_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_u64_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_u64_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_u64_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_u64_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_u128_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_u128_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_u128_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_u128_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_i8_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_i8_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_i8_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_i8_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_i16_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_i16_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_i16_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_i16_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_i32_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_i32_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_i32_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_i32_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_i64_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_i64_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_i64_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_i64_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_i128_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0, 0]); } #[test] fn test_zeros_i128_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0, 0]]); } #[test] fn test_zeros_i128_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0, 0]]]); } #[test] fn test_zeros_i128_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0, 0]]]]); } #[test] fn test_zeros_f32_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0.0, 0.0]); } #[test] fn test_zeros_f32_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0.0, 0.0]]); } #[test] fn test_zeros_f32_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0.0, 0.0]]]); } #[test] fn test_zeros_f32_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0.0, 0.0]]]]); } #[test] fn test_zeros_f64_one_dim() { let arr: Vec = Vec::one_dim().with_shape([2]).zeros().generate(); assert_eq!(arr, [0.0, 0.0]); } #[test] fn test_zeros_f64_two_dim() { let arr: Vec> = Vec::two_dim().with_shape([1, 2]).zeros().generate(); assert_eq!(arr, [[0.0, 0.0]]); } #[test] fn test_zeros_f64_three_dim() { let arr: Vec>> = Vec::three_dim().with_shape([1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[0.0, 0.0]]]); } #[test] fn test_zeros_f64_four_dim() { let arr: Vec>>> = Vec::four_dim().with_shape([1, 1, 1, 2]).zeros().generate(); assert_eq!(arr, [[[[0.0, 0.0]]]]); }