Permalink
Browse files

updates

  • Loading branch information...
1 parent 27c4af9 commit fbcf0739f92ce61a868ec09c14b4b2bd866f7fed Drew LeSueur committed Mar 20, 2013
Showing with 7 additions and 5 deletions.
  1. +3 −1 tests.html
  2. +1 −3 to_linked_list.js
  3. +3 −1 to_linked_list_test.js
View
@@ -35,9 +35,11 @@
console.log(linked_list)
console.log(JSON.stringify(linked_list))
-if (JSON.stringify(linked_list) == '["nname",["drew",[["likes",["computer",["and",[["video making",["and"]],["being a dad"]]]]],["fun!"]]]]') {
+expected = '["name",["drew",[["likes",["computer",["and",[["video making",["and"]],["being a dad"]]]]],["fun!"]]]]'
+if (JSON.stringify(linked_list) == expected) {
console.log("test passed")
} else {
console.log("test failed")
+ console.log(expected)
}
</script>
View
@@ -4,9 +4,7 @@ var to_linked_list = function (list, list_i, parent_node, current_node) {
if (!list_i) { list_i = 0}
- if (list_i == list.length) {
- return parent_node
- }
+ if (list_i == list.length) { return parent_node }
var item = list[list_i]
var new_current_node
@@ -8,8 +8,10 @@ linked_list = to_linked_list(test_array)
console.log(linked_list)
console.log(JSON.stringify(linked_list))
-if (JSON.stringify(linked_list) == '["name",["drew",[["likes",["computer",["and",[["video making",["and"]],["being a dad"]]]]],["fun!"]]]]') {
+expected = '["name",["drew",[["likes",["computer",["and",[["video making",["and"]],["being a dad"]]]]],["fun!"]]]]'
+if (JSON.stringify(linked_list) == expected) {
console.log("test passed")
} else {
console.log("test failed")
+ console.log(expected)
}

0 comments on commit fbcf073

Please sign in to comment.