Report for lv.id.jc.workscope.SurfaceTest


Summary:

Created on Tue Oct 25 14:34:33 UTC 2022 by runner
Executed features Passed Failures Errors Skipped Success rate Time
5 5 0 0 0 100.0% 0.050 seconds
Surface interface
Component test for static methods of Surface interface

Features:

should precisely calculate area of square surface Return
(0)
When:
def square = Surface.square(side)
Then:
square instanceof Surface
And:
square.area() == areaOfSquare
Examples:
side areaOfSquare
1.0 1.0 OK (0)
2.0 4.0 OK (0)
0.1 0.01 OK (0)
0.3 0.09 OK (0)
4/4 passed
should precisely calculate area of rectangle surface Return
(0)
When:
def rectangle = Surface.rectangle(a, b)
Then:
rectangle instanceof Surface
And:
rectangle.area() == areaOfRectangle
Examples:
a b areaOfRectangle
0.1 0.1 0.01 OK (0)
0.1 3 0.3 OK (0)
2 1 2 OK (0)
1 2 2 OK (0)
3 7 21 OK (0)
7 3 21 OK (0)
6/6 passed
should throw an exception for the negative or zero side of the square Return
(0)
When:
def square = Surface.square(side)
Then:
def message = thrown(IllegalArgumentException)
And:
message =~ "must be a positive"
Examples:
side
-7 OK (0)
0 OK (0)
-0.001 OK (0)
-4.9E-324 OK (0)
4/4 passed
should throw an exception for the negative or zero sides of the rectangle Return
(0)
When:
def rectangle = Surface.rectangle(width, height)
Then:
def message = thrown(IllegalArgumentException)
And:
message =~ "must be a positive"
Examples:
width height
0 1 OK (0)
1 0 OK (0)
-1 1 OK (0)
1 -1 OK (0)
0 0 OK (0)
-1 -1 OK (0)
6/6 passed
should subtract one surfaces from other Return
(0.008 seconds)
Given:
def totalSurface = Spy(Surface) { area() >> totalArea }
def apertures = Spy(Surface) { area() >> aperturesArea }
When:
def result = totalSurface - apertures
Then:
result.area() == expectedArea
Examples:
totalArea aperturesArea expectedArea
100 80 20 OK (0.008 seconds)
100 0 100 OK (0)
2/2 passed