MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / test_uuid_hash

Method test_uuid_hash

ruby/test/UUID_Test.rb:45–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 end
44
45 def test_uuid_hash
46 model = OpenStudio::Model::Model.new
47 space1 = OpenStudio::Model::Space.new(model)
48 space1.setName("Space 1")
49 space2 = OpenStudio::Model::Space.new(model)
50 space2.setName("Space 2")
51
52 space1_handle1 = space1.handle
53 space1_handle2 = space1.handle
54 space2_handle1 = space2.handle
55 space2_handle2 = space2.handle
56
57 assert(space1_handle1 == space1_handle1)
58 assert(space1_handle1 == space1_handle2)
59 assert(space1_handle1 != space2_handle1)
60 assert(space1_handle1 != space2_handle2)
61
62 assert(space1_handle1.to_s == space1_handle1.to_s)
63 assert(space1_handle1.to_s == space1_handle2.to_s)
64 assert(space1_handle1.to_s != space2_handle1.to_s)
65 assert(space1_handle1.to_s != space2_handle2.to_s)
66
67 assert(space1_handle1.hash == space1_handle1.hash)
68 assert(space1_handle1.hash == space1_handle2.hash)
69 assert(space1_handle1.hash != space2_handle1.hash)
70 assert(space1_handle1.hash != space2_handle2.hash)
71
72 assert(space1_handle1.eql?(space1_handle1))
73 assert(space1_handle1.eql?(space1_handle2))
74 assert(!space1_handle1.eql?(space2_handle1))
75 assert(!space1_handle1.eql?(space2_handle2))
76
77 assert(space1_handle1.to_s != space1_handle1)
78 assert(space1_handle1.to_s != space1_handle2)
79 assert(space1_handle1.to_s != space2_handle1)
80 assert(space1_handle1.to_s != space2_handle2)
81
82 handle_to_space_map = {}
83 handle_to_space_map[space1_handle1] = space1
84 handle_to_space_map[space2_handle1] = space2
85 assert(handle_to_space_map[space1_handle1] == space1)
86 assert(handle_to_space_map[space1_handle2] == space1)
87 assert(handle_to_space_map[space2_handle1] == space2)
88 assert(handle_to_space_map[space2_handle2] == space2)
89 assert(handle_to_space_map[space1_handle1.to_s] != space1)
90 assert(handle_to_space_map[space1_handle2.to_s] != space1)
91 assert(handle_to_space_map[space2_handle1.to_s] != space2)
92 assert(handle_to_space_map[space2_handle2.to_s] != space2)
93
94 handle_str_to_space_map = {}
95 handle_str_to_space_map[space1_handle1.to_s] = space1
96 handle_str_to_space_map[space2_handle1.to_s] = space2
97 assert(handle_str_to_space_map[space1_handle1.to_s] == space1)
98 assert(handle_str_to_space_map[space1_handle2.to_s] == space1)
99 assert(handle_str_to_space_map[space2_handle1.to_s] == space2)
100 assert(handle_str_to_space_map[space2_handle2.to_s] == space2)
101 assert(handle_str_to_space_map[space1_handle1] != space1)
102 assert(handle_str_to_space_map[space1_handle2] != space1)

Callers

nothing calls this directly

Calls 4

to_sMethod · 0.80
hashMethod · 0.80
setNameMethod · 0.45
handleMethod · 0.45

Tested by

no test coverage detected