Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _parts/part10.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ Here's a test case for the new printing functionality!
+ script << ".exit"
+ result = run_script(script)
+
+ expect(result[14...(result.length)]).to eq([
+ expect(result[14...(result.length)]).to match_array([
+ "db > Tree:",
+ "- internal (size 1)",
+ " - leaf (size 7)",
Expand Down
2 changes: 1 addition & 1 deletion _parts/part11.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ And that reveals that our 1400-row test outputs this error:
script << ".exit"
result = run_script(script)
- expect(result[-2]).to eq('db > Error: Table full.')
+ expect(result.last(2)).to eq([
+ expect(result.last(2)).to match_array([
+ "db > Executed.",
+ "db > Need to implement updating parent after split",
+ ])
Expand Down
2 changes: 1 addition & 1 deletion _parts/part12.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ We now support constructing a multi-level btree, but we've broken `select` state
+ script << ".exit"
+ result = run_script(script)
+
+ expect(result[15...result.length]).to eq([
+ expect(result[15...result.length]).to match_array([
+ "db > (1, user1, person1@example.com)",
+ "(2, user2, person2@example.com)",
+ "(3, user3, person3@example.com)",
Expand Down
2 changes: 1 addition & 1 deletion _parts/part13.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Speaking of tests, our large-dataset test gets past our old stub and gets to our
```diff
@@ -65,7 +65,7 @@ describe 'database' do
result = run_script(script)
expect(result.last(2)).to eq([
expect(result.last(2)).to match_array([
"db > Executed.",
- "db > Need to implement updating parent after split",
+ "db > Need to implement splitting internal node",
Expand Down
16 changes: 8 additions & 8 deletions _parts/part4.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe 'database' do
"select",
".exit",
])
expect(result).to eq([
expect(result).to match_array([
"db > Executed.",
"db > (1, user1, person1@example.com)",
"Executed.",
Expand Down Expand Up @@ -85,7 +85,7 @@ it 'allows inserting strings that are the maximum length' do
".exit",
]
result = run_script(script)
expect(result).to eq([
expect(result).to match_array([
"db > Executed.",
"db > (1, #{long_username}, #{long_email})",
"Executed.",
Expand Down Expand Up @@ -151,7 +151,7 @@ it 'prints error message if strings are too long' do
".exit",
]
result = run_script(script)
expect(result).to eq([
expect(result).to match_array([
"db > String is too long.",
"db > Executed.",
"db > ",
Expand Down Expand Up @@ -263,7 +263,7 @@ it 'prints an error message if id is negative' do
".exit",
]
result = run_script(script)
expect(result).to eq([
expect(result).to match_array([
"db > ID must be positive.",
"db > Executed.",
"db > ",
Expand Down Expand Up @@ -410,7 +410,7 @@ And we added tests:
+ "select",
+ ".exit",
+ ])
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > Executed.",
+ "db > (1, user1, person1@example.com)",
+ "Executed.",
Expand All @@ -436,7 +436,7 @@ And we added tests:
+ ".exit",
+ ]
+ result = run_script(script)
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > Executed.",
+ "db > (1, #{long_username}, #{long_email})",
+ "Executed.",
Expand All @@ -453,7 +453,7 @@ And we added tests:
+ ".exit",
+ ]
+ result = run_script(script)
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > String is too long.",
+ "db > Executed.",
+ "db > ",
Expand All @@ -467,7 +467,7 @@ And we added tests:
+ ".exit",
+ ]
+ result = run_script(script)
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > ID must be positive.",
+ "db > Executed.",
+ "db > ",
Expand Down
12 changes: 6 additions & 6 deletions _parts/part5.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ it 'keeps data after closing connection' do
"insert 1 user1 person1@example.com",
".exit",
])
expect(result1).to eq([
expect(result1).to match_array([
"db > Executed.",
"db > ",
])
result2 = run_script([
"select",
".exit",
])
expect(result2).to eq([
expect(result2).to match_array([
"db > (1, user1, person1@example.com)",
"Executed.",
"db > ",
Expand Down Expand Up @@ -533,7 +533,7 @@ index 21561ce..bc0180a 100644
+ "insert 1 user1 person1@example.com",
+ ".exit",
+ ])
+ expect(result1).to eq([
+ expect(result1).to match_array([
+ "db > Executed.",
+ "db > ",
+ ])
Expand All @@ -542,7 +542,7 @@ index 21561ce..bc0180a 100644
+ "select",
+ ".exit",
+ ])
+ expect(result2).to eq([
+ expect(result2).to match_array([
+ "db > (1, user1, person1@example.com)",
+ "Executed.",
+ "db > ",
Expand Down Expand Up @@ -577,7 +577,7 @@ And the diff to our tests:
+ "insert 1 user1 person1@example.com",
+ ".exit",
+ ])
+ expect(result1).to eq([
+ expect(result1).to match_array([
+ "db > Executed.",
+ "db > ",
+ ])
Expand All @@ -586,7 +586,7 @@ And the diff to our tests:
+ "select",
+ ".exit",
+ ])
+ expect(result2).to eq([
+ expect(result2).to match_array([
+ "db > (1, user1, person1@example.com)",
+ "Executed.",
+ "db > ",
Expand Down
8 changes: 4 additions & 4 deletions _parts/part8.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ I'm also adding a test so we get alerted when those constants change:
+ ]
+ result = run_script(script)
+
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > Constants:",
+ "ROW_SIZE: 293",
+ "COMMON_NODE_HEADER_SIZE: 6",
Expand Down Expand Up @@ -477,7 +477,7 @@ And a test
+ script << ".exit"
+ result = run_script(script)
+
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > Executed.",
+ "db > Executed.",
+ "db > Executed.",
Expand Down Expand Up @@ -829,7 +829,7 @@ And the specs:
+ script << ".exit"
+ result = run_script(script)
+
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > Executed.",
+ "db > Executed.",
+ "db > Executed.",
Expand All @@ -849,7 +849,7 @@ And the specs:
+ ]
+ result = run_script(script)
+
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > Constants:",
+ "ROW_SIZE: 293",
+ "COMMON_NODE_HEADER_SIZE: 6",
Expand Down
2 changes: 1 addition & 1 deletion _parts/part9.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ And we can add a new test for duplicate keys:
+ ".exit",
+ ]
+ result = run_script(script)
+ expect(result).to eq([
+ expect(result).to match_array([
+ "db > Executed.",
+ "db > Error: Duplicate key.",
+ "db > (1, user1, person1@example.com)",
Expand Down
26 changes: 13 additions & 13 deletions spec/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run_script(commands)
"select",
".exit",
])
expect(result).to eq([
expect(result).to match_array([
"db > Executed.",
"db > (1, user1, person1@example.com)",
"Executed.",
Expand All @@ -41,7 +41,7 @@ def run_script(commands)
"insert 1 user1 person1@example.com",
".exit",
])
expect(result1).to eq([
expect(result1).to match_array([
"db > Executed.",
"db > ",
])
Expand All @@ -50,7 +50,7 @@ def run_script(commands)
"select",
".exit",
])
expect(result2).to eq([
expect(result2).to match_array([
"db > (1, user1, person1@example.com)",
"Executed.",
"db > ",
Expand All @@ -63,7 +63,7 @@ def run_script(commands)
end
script << ".exit"
result = run_script(script)
expect(result.last(2)).to eq([
expect(result.last(2)).to match_array([
"db > Executed.",
"db > Need to implement splitting internal node",
])
Expand All @@ -78,7 +78,7 @@ def run_script(commands)
".exit",
]
result = run_script(script)
expect(result).to eq([
expect(result).to match_array([
"db > Executed.",
"db > (1, #{long_username}, #{long_email})",
"Executed.",
Expand All @@ -95,7 +95,7 @@ def run_script(commands)
".exit",
]
result = run_script(script)
expect(result).to eq([
expect(result).to match_array([
"db > String is too long.",
"db > Executed.",
"db > ",
Expand All @@ -109,7 +109,7 @@ def run_script(commands)
".exit",
]
result = run_script(script)
expect(result).to eq([
expect(result).to match_array([
"db > ID must be positive.",
"db > Executed.",
"db > ",
Expand All @@ -124,7 +124,7 @@ def run_script(commands)
".exit",
]
result = run_script(script)
expect(result).to eq([
expect(result).to match_array([
"db > Executed.",
"db > Error: Duplicate key.",
"db > (1, user1, person1@example.com)",
Expand All @@ -141,7 +141,7 @@ def run_script(commands)
script << ".exit"
result = run_script(script)

expect(result).to eq([
expect(result).to match_array([
"db > Executed.",
"db > Executed.",
"db > Executed.",
Expand All @@ -163,7 +163,7 @@ def run_script(commands)
script << ".exit"
result = run_script(script)

expect(result[14...(result.length)]).to eq([
expect(result[14...(result.length)]).to match_array([
"db > Tree:",
"- internal (size 1)",
" - leaf (size 7)",
Expand Down Expand Up @@ -225,7 +225,7 @@ def run_script(commands)
]
result = run_script(script)

expect(result[30...(result.length)]).to eq([
expect(result[30...(result.length)]).to match_array([
"db > Tree:",
"- internal (size 3)",
" - leaf (size 7)",
Expand Down Expand Up @@ -276,7 +276,7 @@ def run_script(commands)
]
result = run_script(script)

expect(result).to eq([
expect(result).to match_array([
"db > Constants:",
"ROW_SIZE: 293",
"COMMON_NODE_HEADER_SIZE: 6",
Expand All @@ -296,7 +296,7 @@ def run_script(commands)
script << "select"
script << ".exit"
result = run_script(script)
expect(result[15...result.length]).to eq([
expect(result[15...result.length]).to match_array([
"db > (1, user1, person1@example.com)",
"(2, user2, person2@example.com)",
"(3, user3, person3@example.com)",
Expand Down