1"""
2File: test_api.py
3Author: Dilawar Singh
4Email: dilawars@ncbs.res.in
5Github: https://github.com/yourname
6Description:
7    Tests for user api.
8"""
9
10import smoldyn as S
11
12
13def test_rectangles():
14    """Tests geometric shape by converting them to quivalent smoldyn text
15    lines.
16
17    >>> test_rectangles()
18    panel PanelShape.rect +x 0 10 1 10 20 A
19    panel PanelShape.tri  0 0 0 1 1 1 1 3 -10 t1
20    panel PanelShape.sph  0 -10 0 3 10 10 s1
21    panel PanelShape.cyl  20 30 70 20 50 70 4 20 20 cyl1
22    panel PanelShape.disk  20 20 20 10 10 20 20 d1
23    """
24    r1 = S.Rectangle((0, 10, 1), dimensions=(10, 20), axis="+x", name="A")
25    print(r1.toText())
26    tr = S.Triangle(vertices=[[0, 0, 0], [1, 1, 1], [1, 3, -10]], name="t1")
27    print(tr.toText())
28    sph = S.Sphere(center=[0, -10, 0], radius=3, slices=10, stacks=10, name="s1")
29    print(sph.toText())
30    cyl = S.Cylinder(start=[20, 30, 70], end=[20, 50, 70], radius=4, slices=20,stacks=20, name="cyl1")
31    print(cyl.toText())
32    disk = S.Disk(center=[20, 20, 20], radius=10, vector=[10, 20, 20], name="d1")
33    print(disk.toText())
34
35
36if __name__ == "__main__":
37    import doctest
38
39    doctest.testmod()
40