Skip to content

Commit 158690e

Browse files
committed
Add more tests for System module.
1 parent 530335a commit 158690e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/memory/leak/system.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,36 @@
1111
expect(subject.total_memory_size).to be_a(Integer)
1212
end
1313
end
14+
15+
with ".memory_usage" do
16+
it "can determine the memory usage" do
17+
expect(subject.memory_usage(Process.pid)).to be_a(Integer)
18+
end
19+
20+
it "returns 0 for invalid process ID" do
21+
expect(subject.memory_usage(0)).to be == 0
22+
end
23+
end
24+
25+
with ".memory_usages" do
26+
it "can determine the memory usages" do
27+
result = subject.memory_usages([Process.pid])
28+
expect(result).to be_a(Array)
29+
30+
result.each do |process_id, size|
31+
expect(process_id).to be_a(Integer)
32+
expect(size).to be_a(Integer)
33+
end
34+
end
35+
36+
it "ignores invalid process IDs" do
37+
result = subject.memory_usages([Process.pid, 0])
38+
expect(result).to be_a(Array)
39+
40+
result.each do |process_id, size|
41+
expect(process_id).to be_a(Integer)
42+
expect(size).to be > 0
43+
end
44+
end
45+
end
1446
end

0 commit comments

Comments
 (0)