Skip to content

Commit

Permalink
Fix test-suite tester functions to show (found, expected) shape (glue…
Browse files Browse the repository at this point in the history
  • Loading branch information
panarch committed Dec 1, 2022
1 parent 34c628c commit 97ee20c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test-suite/src/tester/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn test(found: Result<Payload>, expected: Result<Payload>) {
rows: b,
},
) => {
assert_eq!(expected_labels, found_labels);
assert_eq!(found_labels, expected_labels);

(a, b)
}
Expand All @@ -58,7 +58,7 @@ pub fn test(found: Result<Payload>, expected: Result<Payload>) {
expected
);

let rows = expected.into_iter().zip(found.into_iter()).enumerate();
let rows = found.into_iter().zip(expected.into_iter()).enumerate();

for (i, (found, expected)) in rows {
assert_eq!(
Expand All @@ -70,9 +70,9 @@ pub fn test(found: Result<Payload>, expected: Result<Payload>) {
expected
);

expected
found
.iter()
.zip(found.iter())
.zip(expected.iter())
.for_each(|(found_val, expected_val)| {
if matches!((found_val, expected_val), (&Value::Null, &Value::Null)) {
return;
Expand Down Expand Up @@ -110,9 +110,9 @@ pub fn test_indexes(statement: &Statement, indexes: Option<Vec<IndexItem>>) {

if expected.len() != found.len() {
panic!(
"num of indexes does not match: expected({}) != found({})",
expected.len(),
"num of indexes does not match: found({}) != expected({})",
found.len(),
expected.len(),
);
}

Expand Down Expand Up @@ -184,10 +184,10 @@ pub fn type_match(expected: &[DataType], found: Result<Payload>) {
assert_eq!(
items.len(),
expected.len(),
"\n[err: size of row] row index: {}\n expected: {:?}\n found: {:?}",
"\n[err: size of row] row index: {}\n found: {:?}\n expected: {:?}",
i,
expected.len(),
items.len()
items.len(),
expected.len()
);

items
Expand All @@ -196,8 +196,8 @@ pub fn type_match(expected: &[DataType], found: Result<Payload>) {
.for_each(|(value, data_type)| match value.validate_type(data_type) {
Ok(_) => {}
Err(_) => panic!(
"[err: type match failed]\n expected {:?}\n found {:?}\n",
data_type, value
"[err: type match failed]\n found {:?}\n expected {:?}\n",
value, data_type
),
})
}
Expand Down

0 comments on commit 97ee20c

Please sign in to comment.