-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_133_clone_graph.rb
49 lines (44 loc) · 1003 Bytes
/
test_133_clone_graph.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true
require_relative '../test_helper'
require_relative '../../lib/common/node_with_neighbors'
require_relative '../../lib/medium/133_clone_graph'
require 'minitest/autorun'
class CloneGraphTest < ::Minitest::Test
def test_default_one
g1 = ::NodeWithNeighbors.new(1)
g2 = ::NodeWithNeighbors.new(2)
g3 = ::NodeWithNeighbors.new(3)
g4 = ::NodeWithNeighbors.new(4)
g1.neighbors << g2
g1.neighbors << g4
g2.neighbors << g1
g2.neighbors << g3
g3.neighbors << g2
g3.neighbors << g4
g4.neighbors << g1
g4.neighbors << g4
assert(
::NodeWithNeighbors.are_equals(
g1,
clone_graph(g1)
)
)
end
def test_default_two
g1 = ::NodeWithNeighbors.new(1)
assert(
::NodeWithNeighbors.are_equals(
g1,
clone_graph(g1)
)
)
end
def test_default_three
assert(
::NodeWithNeighbors.are_equals(
nil,
clone_graph(nil)
)
)
end
end