| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import cffi_mixed |
| 4 |
|
| 5 |
from cffi_mixed import Line |
| 6 |
|
| 7 |
|
| 8 |
def test_in_range(): |
| 9 |
point = cffi_mixed.lib.get_origin() |
| 10 |
point.x = 10 |
| 11 |
point.y = 10 |
| 12 |
|
| 13 |
assert not cffi_mixed.lib.is_in_range(point, 14) |
| 14 |
assert cffi_mixed.lib.is_in_range(point, 15) |
| 15 |
|
| 16 |
|
| 17 |
def test_ffi(): |
| 18 |
point = cffi_mixed.ffi.new("Point *", (10, 20)) |
| 19 |
assert point.x == 10 |
| 20 |
assert point.y == 20 |
| 21 |
|
| 22 |
|
| 23 |
def test_line(): |
| 24 |
line = Line(2, 5, 6, 8) |
| 25 |
assert line.length() == 5 |
| 26 |
assert str(line) == "Line from (2.0,5.0) to (6.0,8.0)" |