-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.rb
42 lines (38 loc) · 865 Bytes
/
test.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
require 'epeg'
require 'test/unit'
class TestEpeg < Test::Unit::TestCase
def setup
@epeg = Epeg.new('test.jpg')
end
def test_new
assert_equal(Epeg, @epeg.class)
end
def test_size
assert_equal(@epeg.size, [182, 170])
end
def test_finish
assert(@epeg.finish)
assert_raises(StandardError) { @epeg.finish }
end
def test_output_size
assert_nothing_raised { @epeg.set_output_size(16,16) }
@epeg.finish
assert_raises(StandardError) { @epeg.set_output_size(16,16) }
end
def test_finish_return
@epeg.set_output_size(128,128)
assert_equal(Epeg.thumbnail('test.jpg', 128, 128), @epeg.finish)
end
end
class TestEpegBad < Test::Unit::TestCase
def test_bad_file
assert_raises(StandardError) {
Epeg.new('/dev/null')
}
end
def test_nonexistant_file
assert_raises(StandardError) {
Epeg.new('/askdfhalskdfhasldfahsdf')
}
end
end