diff options
Diffstat (limited to 'v_windows/v/vlib/v/tests/modules/geometry/geometry.v')
-rw-r--r-- | v_windows/v/vlib/v/tests/modules/geometry/geometry.v | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/v_windows/v/vlib/v/tests/modules/geometry/geometry.v b/v_windows/v/vlib/v/tests/modules/geometry/geometry.v new file mode 100644 index 0000000..4913c21 --- /dev/null +++ b/v_windows/v/vlib/v/tests/modules/geometry/geometry.v @@ -0,0 +1,50 @@ +module geometry + +const ( + module_name = 'geometry' +) + +pub enum Shape { + circle + rectangle + triangle +} + +pub type ShapeMap = map[Shape]string + +// used by vlib/v/tests/map_enum_keys_test.v +pub enum Form3D { + sphere + cylinder + cone + cube + invalid +} + +pub struct Point { +pub mut: + x int + y int +} + +pub struct Line { +pub mut: + ps []Point +} + +pub fn (a Point) + (b Point) Point { + return Point{ + x: a.x + b.x + y: a.y + b.y + } +} + +pub fn (a Point) str() string { + return '$a.x $a.y' +} + +pub fn point_str(a Point) string { + return a.str() +} + +pub type PointCond = fn (p Point) bool |