Skip to content

Commit 2227ce5

Browse files
author
Samuel Grave
committed
🚨 Fix linter errors
1 parent dc99f88 commit 2227ce5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/ruby/binary_search_tree.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class BinarySearchTree
24
class Node
35
attr_accessor :left, :right, :value
@@ -152,8 +154,8 @@ def find_leftmost(node)
152154
bst.insert(1)
153155
end
154156

155-
describe '#insert' do
156-
it 'adds a value to the tree' do
157+
describe "#insert" do
158+
it "adds a value to the tree" do
157159
expect(bst.traverse).to eq({ value: 9,
158160
left: { value: 4,
159161
left: { value: 1, left: nil, right: nil },
@@ -163,20 +165,20 @@ def find_leftmost(node)
163165
end
164166
end
165167

166-
describe '#lookup' do
167-
it 'finds a value in the tree' do
168+
describe "#lookup" do
169+
it "finds a value in the tree" do
168170
node = bst.lookup(15)
169171
expect(node.value).to eq(15)
170172
end
171173

172-
it 'returns nil for a value not in the tree' do
174+
it "returns nil for a value not in the tree" do
173175
node = bst.lookup(100)
174176
expect(node).to be_nil
175177
end
176178
end
177179

178-
describe '#remove' do
179-
it 'removes a leaf node' do
180+
describe "#remove" do
181+
it "removes a leaf node" do
180182
expect(bst.remove(1)).to be true
181183

182184
expect(bst.traverse).to eq({ value: 9,
@@ -186,7 +188,7 @@ def find_leftmost(node)
186188
right: { value: 170, left: nil, right: nil } } })
187189
end
188190

189-
it 'removes a node with one child' do
191+
it "removes a node with one child" do
190192
expect(bst.remove(20)).to be true
191193

192194
expect(bst.traverse).to eq({ value: 9,
@@ -196,7 +198,7 @@ def find_leftmost(node)
196198
right: nil } })
197199
end
198200

199-
it 'removes a node with two children' do
201+
it "removes a node with two children" do
200202
expect(bst.remove(4)).to be true
201203

202204
expect(bst.traverse).to eq({ value: 9,
@@ -206,7 +208,7 @@ def find_leftmost(node)
206208
right: { value: 170, left: nil, right: nil } } })
207209
end
208210

209-
it 'returns false for a value not in the tree' do
211+
it "returns false for a value not in the tree" do
210212
expect(bst.remove(100)).to be false
211213
end
212214
end

0 commit comments

Comments
 (0)