Skip to content

Commit

Permalink
Implement RandValue trait, import SerialArray and use in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
shanicky committed Mar 6, 2023
1 parent 0eb8c16 commit f37ef4c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/common/src/test_utils/rand_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use rand::prelude::Distribution;
use rand::rngs::SmallRng;
use rand::{Rng, SeedableRng};

use crate::array::serial_array::Serial;
use crate::array::{Array, ArrayBuilder, ArrayRef, JsonbVal, ListValue, StructValue};
use crate::types::{
Decimal, IntervalUnit, NaiveDateTimeWrapper, NaiveDateWrapper, NaiveTimeWrapper, NativeType,
Expand Down Expand Up @@ -117,6 +118,12 @@ impl RandValue for bool {
}
}

impl RandValue for Serial {
fn rand_value<R: Rng>(rand: &mut R) -> Self {
i64::rand_value(rand).into()
}
}

impl RandValue for JsonbVal {
fn rand_value<R: rand::Rng>(_rand: &mut R) -> Self {
JsonbVal::dummy()
Expand Down Expand Up @@ -177,6 +184,7 @@ where
mod tests {
use super::*;
use crate::array::interval_array::IntervalArray;
use crate::array::serial_array::SerialArray;
use crate::array::*;
use crate::for_all_variants;

Expand Down

0 comments on commit f37ef4c

Please sign in to comment.