Skip to content

[test] apply the new test style to common_functions #2631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions common/functions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ license = "Apache-2.0"
publish = false
edition = "2021"

[lib]
doctest = false
test = false

[dependencies] # In alphabetical order
# Workspace dependencies
common-arrow = {path = "../arrow"}
Expand Down
5 changes: 0 additions & 5 deletions common/functions/src/aggregates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod aggregate_combinator_test;
#[cfg(test)]
mod aggregate_function_test;

mod aggregate_arg_min_max;
mod aggregate_avg;
mod aggregate_combinator_distinct;
Expand Down
3 changes: 0 additions & 3 deletions common/functions/src/scalars/arithmetics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod arithmetic_test;

mod arithmetic;
mod arithmetic_div;
mod arithmetic_minus;
Expand Down
3 changes: 0 additions & 3 deletions common/functions/src/scalars/comparisons/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod comparison_test;

mod comparison;
mod comparison_eq;
mod comparison_gt;
Expand Down
2 changes: 0 additions & 2 deletions common/functions/src/scalars/conditionals/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

mod conditional;
mod r#if;
#[cfg(test)]
mod if_test;

pub use conditional::ConditionalFunction;
pub use r#if::IfFunction;
9 changes: 1 addition & 8 deletions common/functions/src/scalars/dates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
// limitations under the License.

mod date;
#[cfg(test)]
mod date_function_test;
#[cfg(test)]
mod date_test;

#[cfg(test)]
mod interval_function_test;

mod interval_function;
mod now;
mod number_function;
Expand All @@ -38,6 +30,7 @@ pub use number_function::ToDayOfWeekFunction;
pub use number_function::ToDayOfYearFunction;
pub use number_function::ToHourFunction;
pub use number_function::ToMinuteFunction;
pub use number_function::ToMondayFunction;
pub use number_function::ToMonthFunction;
pub use number_function::ToSecondFunction;
pub use number_function::ToStartOfISOYearFunction;
Expand Down
5 changes: 1 addition & 4 deletions common/functions/src/scalars/expressions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod cast_test;
mod expression;

mod cast;
mod expression;

pub use cast::CastFunction;
pub use expression::ToCastFunction;
3 changes: 0 additions & 3 deletions common/functions/src/scalars/hashes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod siphash_test;

mod hash;
mod siphash;

Expand Down
3 changes: 0 additions & 3 deletions common/functions/src/scalars/logics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod logic_test;

mod logic;
mod logic_and;
mod logic_not;
Expand Down
9 changes: 0 additions & 9 deletions common/functions/src/scalars/maths/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod abs_test;
#[cfg(test)]
mod crc32_test;
#[cfg(test)]
mod pi_test;
#[cfg(test)]
mod trigonometric_test;

mod abs;
mod crc32;
mod math;
Expand Down
2 changes: 0 additions & 2 deletions common/functions/src/scalars/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ mod expressions;
mod function;
mod function_alias;
mod function_column;
#[cfg(test)]
mod function_column_test;
mod function_factory;
mod function_literal;
mod hashes;
Expand Down
2 changes: 0 additions & 2 deletions common/functions/src/scalars/nullables/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
mod is_not_null;
mod is_null;
mod nullable;
#[cfg(test)]
mod nullable_test;

pub use is_not_null::IsNotNullFunction;
pub use is_null::IsNullFunction;
Expand Down
3 changes: 1 addition & 2 deletions common/functions/src/scalars/others/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
// 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.
#[cfg(test)]
mod running_difference_function_test;

mod other;
mod running_difference_function;

pub use other::OtherFunction;
pub use running_difference_function::RunningDifferenceFunction;
3 changes: 0 additions & 3 deletions common/functions/src/scalars/strings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod substring_test;

mod string;
mod substring;

Expand Down
9 changes: 0 additions & 9 deletions common/functions/src/scalars/udfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod database_test;
#[cfg(test)]
mod to_type_name_test;
#[cfg(test)]
mod udf_example_test;
#[cfg(test)]
mod version_test;

mod crash_me;
mod database;
mod exists;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
use bumpalo::Bump;
use common_datavalues::prelude::*;
use common_exception::Result;
use common_functions::aggregates::AggregateFunctionFactory;
use pretty_assertions::assert_eq;

use crate::aggregates::aggregate_function_factory::AggregateFunctionFactory;

#[test]
fn test_aggregate_combinator_function() -> Result<()> {
struct Test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
use bumpalo::Bump;
use common_datavalues::prelude::*;
use common_exception::Result;
use common_functions::aggregates::*;
use float_cmp::approx_eq;
use pretty_assertions::assert_eq;

use crate::aggregates::*;

#[test]
fn test_aggregate_function() -> Result<()> {
struct Test {
Expand Down
16 changes: 16 additions & 0 deletions common/functions/tests/it/aggregates/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2020 Datafuse Labs.
//
// 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.

mod aggregate_combinator;
mod aggregate_function;
16 changes: 16 additions & 0 deletions common/functions/tests/it/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2020 Datafuse Labs.
//
// 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.

mod aggregates;
mod scalars;
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
use common_datavalues::chrono;
use common_datavalues::prelude::*;
use common_exception::Result;
use common_functions::scalars::*;
use pretty_assertions::assert_eq;

use crate::scalars::*;

#[test]
fn test_arithmetic_function() -> Result<()> {
#[allow(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

use common_datavalues::prelude::*;
use common_exception::Result;
use common_functions::scalars::*;
use pretty_assertions::assert_eq;

use crate::scalars::*;

#[test]
fn test_comparison_function() -> Result<()> {
#[allow(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
use common_datavalues::prelude::*;
use common_datavalues::DataType;
use common_exception::Result;
use common_functions::scalars::*;
use pretty_assertions::assert_eq;

use crate::scalars::*;

#[test]
fn test_if_function() -> Result<()> {
#[allow(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
// 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.

use common_datavalues::prelude::*;
use common_exception::Result;
use common_functions::scalars::*;
use pretty_assertions::assert_eq;

use super::RoundFunction;
use crate::scalars::*;

#[allow(dead_code)]
struct Test {
name: &'static str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@

use common_datavalues::prelude::*;
use common_exception::Result;

use crate::scalars::dates::number_function::ToDayOfMonthFunction;
use crate::scalars::dates::number_function::ToDayOfWeekFunction;
use crate::scalars::dates::number_function::ToDayOfYearFunction;
use crate::scalars::dates::number_function::ToMinuteFunction;
use crate::scalars::dates::number_function::ToMondayFunction;
use crate::scalars::dates::number_function::ToMonthFunction;
use crate::scalars::Function;
use crate::scalars::ToHourFunction;
use crate::scalars::ToSecondFunction;
use crate::scalars::ToYYYYMMDDFunction;
use crate::scalars::ToYYYYMMDDhhmmssFunction;
use crate::scalars::ToYYYYMMFunction;
use common_functions::scalars::*;

#[allow(dead_code)]
struct Test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ use common_datablocks::DataBlock;
use common_datavalues::chrono::DateTime;
use common_datavalues::prelude::*;
use common_exception::Result;

use crate::scalars::MonthsArithmeticFunction;
use crate::scalars::SecondsArithmeticFunction;
use common_functions::scalars::MonthsArithmeticFunction;
use common_functions::scalars::SecondsArithmeticFunction;

#[test]
fn test_add_months() -> Result<()> {
Expand Down
17 changes: 17 additions & 0 deletions common/functions/tests/it/scalars/dates/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2020 Datafuse Labs.
//
// 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.

mod date;
mod date_function;
mod interval_function;
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

use common_datavalues::prelude::*;
use common_exception::Result;
use common_functions::scalars::*;
use pretty_assertions::assert_eq;

use crate::scalars::*;

#[test]
fn test_cast_function() -> Result<()> {
#[allow(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
use common_datablocks::*;
use common_datavalues::prelude::*;
use common_exception::Result;

use crate::scalars::*;
use common_functions::scalars::*;

#[test]
fn test_column_function() -> Result<()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
use common_datavalues::columns::DataColumn;
use common_datavalues::prelude::*;
use common_exception::Result;

use crate::scalars::SipHashFunction;
use common_functions::scalars::SipHashFunction;

#[test]
fn test_siphash_function() -> Result<()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

use common_datavalues::prelude::*;
use common_exception::Result;
use common_functions::scalars::*;
use pretty_assertions::assert_eq;

use crate::scalars::*;

#[test]
fn test_logic_function() -> Result<()> {
#[allow(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
use common_datavalues::prelude::*;
use common_exception::ErrorCode;
use common_exception::Result;

use crate::scalars::*;
use common_functions::scalars::*;

#[test]
fn test_abs_function() -> Result<()> {
Expand Down
Loading