Skip to content

Commit

Permalink
add logging into deepEqual inside and outside of canister
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmjs committed Dec 13, 2023
1 parent 91b856c commit 8e58473
Show file tree
Hide file tree
Showing 36 changed files with 50 additions and 137 deletions.
2 changes: 1 addition & 1 deletion property_tests/are_params_correctly_ordered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function areParamsCorrectlyOrdered<T extends CorrespondingJSType>(
${el.src.valueLiteral}
)`;

return `if (!${areEqual}) throw new Error('${name} is incorrectly ordered')`;
return `if (!${areEqual}) {console.log('value', ${name}); throw new Error('${name} is incorrectly ordered');}`;
})
.join('\n');
}
15 changes: 15 additions & 0 deletions property_tests/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import fc from 'fast-check';
// @ts-ignore
import libraryDeepEqual from 'deep-is';

import { Canister } from './arbitraries/canister_arb';
import { existsSync, mkdirSync, writeFileSync } from 'fs';
import { execSync } from 'child_process';
Expand Down Expand Up @@ -72,3 +75,15 @@ export const defaultArrayConstraints = {
minLength: 20,
maxLength: 100
};

export function deepEqual(a: any, b: any): boolean {
const result = libraryDeepEqual(a, b);

if (result === false) {
console.log('deepEqual returned false');
console.log('deepEqual value a', a);
console.log('deepEqual value b', b);
}

return result;
}
5 changes: 1 addition & 4 deletions property_tests/tests/blob/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/bool/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/float32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/float64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/func/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Func } from 'azle/property_tests/arbitraries/candid/reference/func_arb';
import { Test } from 'azle/test';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int16/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int8/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat16/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat8/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/null/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/opt/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Opt } from 'azle/property_tests/arbitraries/candid/constructed/opt_arb';
import { Test } from 'azle/test';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/principal/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Principal } from '@dfinity/principal';

// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/query_methods/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type';
import { CandidReturnType } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/record/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Record } from 'azle/property_tests/arbitraries/candid/constructed/record_arb';
import { Test } from 'azle/test';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/contains_key.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/get.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/insert.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/is_empty.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/items.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/keys.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { getArrayForCandidType, getArrayStringForCandidType } from './utils';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/len.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/remove.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/values.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { getArrayForCandidType, getArrayStringForCandidType } from './utils';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/text/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/tuple/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import {
Tuple,
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/update_methods/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { Named, getActor } from 'azle/property_tests';
import { deepEqual, Named, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { CandidReturnType } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/variant/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Variant } from 'azle/property_tests/arbitraries/candid/constructed/variant_arb';
import { Test } from 'azle/test';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/vec/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down

0 comments on commit 8e58473

Please sign in to comment.