From d38cc2643d7fd5afa22942d91e535c92faaace62 Mon Sep 17 00:00:00 2001 From: Tamir <37386851+tamireinhorn@users.noreply.github.com> Date: Wed, 15 Jun 2022 03:17:08 +0300 Subject: [PATCH 1/6] Add more tests to Satellite --- exercises/satellite/canonical-data.json | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/exercises/satellite/canonical-data.json b/exercises/satellite/canonical-data.json index 19656c0043..640ad072df 100644 --- a/exercises/satellite/canonical-data.json +++ b/exercises/satellite/canonical-data.json @@ -74,6 +74,41 @@ "expected": { "error": "traversals must contain unique items" } + }, + { + "uuid": "d232a4e5-622e-4aaa-965e-244ddcdcdb96", + "description": "Complex tree with many integer values", + "property": "treeFromTraversals", + "input": { + "preorder": ["2", "1", "3", "6", "5", "7"], + "inorder": ["1", "2", "3", "5", "6", "7"] + }, + "expected": { + "v": "4", + "l": {"v": "2", + "l": {"v": "1", "l": {}, "r": {}}, + "r": {"v": "3", "l": {}, "r": {}} + }, + "r": {"v": "6", + "l": {"v": "5", "l": {}, "r": {}}, + "r": {"v": "7", "l": {}, "r": {}} + } + } + }, + { + "uuid": "156a2dd8-a2c7-4a07-b9fe-ab599956d067", + "description": "Simple tree with integer values", + "property": "treeFromTraversals", + "input": { + "preorder": ["2", "1"], + "inorder": ["1", "2"] + }, + "expected": + { + "v": "2", + "l": "1", + "r": {} + } } ] } From 0a8b2fb5b8b33b4f7f552ef2783bfcbb32971903 Mon Sep 17 00:00:00 2001 From: Tamir <37386851+tamireinhorn@users.noreply.github.com> Date: Wed, 15 Jun 2022 03:28:05 +0300 Subject: [PATCH 2/6] Lint with prettier --- exercises/satellite/canonical-data.json | 27 +++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/exercises/satellite/canonical-data.json b/exercises/satellite/canonical-data.json index 640ad072df..a15042975f 100644 --- a/exercises/satellite/canonical-data.json +++ b/exercises/satellite/canonical-data.json @@ -84,16 +84,18 @@ "inorder": ["1", "2", "3", "5", "6", "7"] }, "expected": { - "v": "4", - "l": {"v": "2", - "l": {"v": "1", "l": {}, "r": {}}, - "r": {"v": "3", "l": {}, "r": {}} - }, - "r": {"v": "6", - "l": {"v": "5", "l": {}, "r": {}}, - "r": {"v": "7", "l": {}, "r": {}} - } + "v": "4", + "l": { + "v": "2", + "l": { "v": "1", "l": {}, "r": {} }, + "r": { "v": "3", "l": {}, "r": {} } + }, + "r": { + "v": "6", + "l": { "v": "5", "l": {}, "r": {} }, + "r": { "v": "7", "l": {}, "r": {} } } + } }, { "uuid": "156a2dd8-a2c7-4a07-b9fe-ab599956d067", @@ -103,12 +105,11 @@ "preorder": ["2", "1"], "inorder": ["1", "2"] }, - "expected": - { + "expected": { "v": "2", "l": "1", "r": {} - } + } } ] -} +} \ No newline at end of file From bfd148088592be0771f83004755cedbe838e2cb5 Mon Sep 17 00:00:00 2001 From: Tamir <37386851+tamireinhorn@users.noreply.github.com> Date: Wed, 15 Jun 2022 03:29:03 +0300 Subject: [PATCH 3/6] Added new line to JSON --- exercises/satellite/canonical-data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/satellite/canonical-data.json b/exercises/satellite/canonical-data.json index a15042975f..32de6e4940 100644 --- a/exercises/satellite/canonical-data.json +++ b/exercises/satellite/canonical-data.json @@ -112,4 +112,4 @@ } } ] -} \ No newline at end of file +} From 24056fc95645c6b8678eb0edacfc6f0a8fa9a14c Mon Sep 17 00:00:00 2001 From: Tamir <37386851+tamireinhorn@users.noreply.github.com> Date: Wed, 15 Jun 2022 12:41:23 +0300 Subject: [PATCH 4/6] Update exercises/satellite/canonical-data.json Co-authored-by: Peter Tseng --- exercises/satellite/canonical-data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/satellite/canonical-data.json b/exercises/satellite/canonical-data.json index 32de6e4940..c218be0744 100644 --- a/exercises/satellite/canonical-data.json +++ b/exercises/satellite/canonical-data.json @@ -107,7 +107,7 @@ }, "expected": { "v": "2", - "l": "1", + "l": { "v": "1", "l": {}, "r": {} }, "r": {} } } From 947c3a001cd09b5f198c5dc6ec5ffcd707d7695a Mon Sep 17 00:00:00 2001 From: Tamir <37386851+tamireinhorn@users.noreply.github.com> Date: Thu, 16 Jun 2022 02:57:47 +0300 Subject: [PATCH 5/6] Update canonical-data.json Fixed wrong answer for complex tree. --- exercises/satellite/canonical-data.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/exercises/satellite/canonical-data.json b/exercises/satellite/canonical-data.json index c218be0744..46baf1a93c 100644 --- a/exercises/satellite/canonical-data.json +++ b/exercises/satellite/canonical-data.json @@ -84,16 +84,16 @@ "inorder": ["1", "2", "3", "5", "6", "7"] }, "expected": { - "v": "4", + "v": "2", "l": { - "v": "2", - "l": { "v": "1", "l": {}, "r": {} }, - "r": { "v": "3", "l": {}, "r": {} } + "v": "1", + "l": {}, + "r": {} }, "r": { - "v": "6", - "l": { "v": "5", "l": {}, "r": {} }, - "r": { "v": "7", "l": {}, "r": {} } + "v": "3", + "l": {}, + "r": { "v": "6", "l": {"v": "5", "l":{}, "r": {}}, "r": {"v": "7", "l": {}, "r": {}} } } } }, From 79de48ddcc3e2939d3b67ae568461c388a14292f Mon Sep 17 00:00:00 2001 From: Tamir <37386851+tamireinhorn@users.noreply.github.com> Date: Thu, 16 Jun 2022 03:05:58 +0300 Subject: [PATCH 6/6] Lint JSON and reorder tests --- exercises/satellite/canonical-data.json | 76 +++++++++++++------------ 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/exercises/satellite/canonical-data.json b/exercises/satellite/canonical-data.json index 46baf1a93c..a872fd000b 100644 --- a/exercises/satellite/canonical-data.json +++ b/exercises/satellite/canonical-data.json @@ -21,6 +21,46 @@ }, "expected": { "v": "a", "l": {}, "r": {} } }, + { + "uuid": "156a2dd8-a2c7-4a07-b9fe-ab599956d067", + "description": "Simple tree with integer values", + "property": "treeFromTraversals", + "input": { + "preorder": ["2", "1"], + "inorder": ["1", "2"] + }, + "expected": { + "v": "2", + "l": { "v": "1", "l": {}, "r": {} }, + "r": {} + } + }, + { + "uuid": "d232a4e5-622e-4aaa-965e-244ddcdcdb96", + "description": "Complex tree with many integer values", + "property": "treeFromTraversals", + "input": { + "preorder": ["2", "1", "3", "6", "5", "7"], + "inorder": ["1", "2", "3", "5", "6", "7"] + }, + "expected": { + "v": "2", + "l": { + "v": "1", + "l": {}, + "r": {} + }, + "r": { + "v": "3", + "l": {}, + "r": { + "v": "6", + "l": { "v": "5", "l": {}, "r": {} }, + "r": { "v": "7", "l": {}, "r": {} } + } + } + } + }, { "uuid": "a0121d5f-37b0-48dd-9c64-cba4c4464135", "description": "Tree with many items", @@ -74,42 +114,6 @@ "expected": { "error": "traversals must contain unique items" } - }, - { - "uuid": "d232a4e5-622e-4aaa-965e-244ddcdcdb96", - "description": "Complex tree with many integer values", - "property": "treeFromTraversals", - "input": { - "preorder": ["2", "1", "3", "6", "5", "7"], - "inorder": ["1", "2", "3", "5", "6", "7"] - }, - "expected": { - "v": "2", - "l": { - "v": "1", - "l": {}, - "r": {} - }, - "r": { - "v": "3", - "l": {}, - "r": { "v": "6", "l": {"v": "5", "l":{}, "r": {}}, "r": {"v": "7", "l": {}, "r": {}} } - } - } - }, - { - "uuid": "156a2dd8-a2c7-4a07-b9fe-ab599956d067", - "description": "Simple tree with integer values", - "property": "treeFromTraversals", - "input": { - "preorder": ["2", "1"], - "inorder": ["1", "2"] - }, - "expected": { - "v": "2", - "l": { "v": "1", "l": {}, "r": {} }, - "r": {} - } } ] }