|
| 1 | +// Copyright 2021 Datafuse Labs |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#![no_main] |
| 16 | + |
| 17 | +use databend_expression_domain_fuzz::ColumnCase; |
| 18 | +use databend_expression_domain_fuzz::run_column_case; |
| 19 | +use libfuzzer_sys::fuzz_target; |
| 20 | + |
| 21 | +// This target validates the fundamental `Column::domain` invariant: every value physically present |
| 22 | +// in a generated column must be contained by the domain returned for that column. |
| 23 | + |
| 24 | +// The typed `Arbitrary` generator covers empty and NULL columns, all number and decimal widths, |
| 25 | +// Boolean, String, temporal and interval columns, Binary, and recursive Nullable, Array, Map, and |
| 26 | +// Tuple shapes. Array and Map offsets may start above zero so sliced-column behavior is exercised as |
| 27 | +// well. |
| 28 | + |
| 29 | +// For every row, the oracle recursively checks the actual scalar value against the column domain. |
| 30 | +// Nullable checks NULL membership, Array and Map check their real elements, and Tuple checks each |
| 31 | +// field. Primitive values use singleton-domain containment. Undefined domains accept unsupported |
| 32 | +// scalar types by definition. |
| 33 | +// |
| 34 | +// cargo fuzz run --dev --sanitizer none --strip-dead-code column_domain -- -runs=10000 -max_len=4096 |
| 35 | +fuzz_target!(|case: ColumnCase| run_column_case(case)); |
0 commit comments