2025-10-27 07:04:57 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
2025-10-27 07:10:43 +00:00
|
|
|
"github.com/goplus/llgo/_demo/issue1370_geometry/geometry"
|
2025-10-27 07:04:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
rect := geometry.NewRectangle(5.0, 3.0)
|
|
|
|
|
|
|
|
|
|
err := geometry.RegisterShape(rect, 42)
|
|
|
|
|
if err != nil {
|
|
|
|
|
println("FAIL: RegisterShape returned error")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if rect.GetID() != 42 {
|
|
|
|
|
println("FAIL: ID not set correctly")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
area := rect.Area()
|
|
|
|
|
fmt.Printf("Area: %.1f\n", area)
|
|
|
|
|
|
|
|
|
|
if area != 15.0 {
|
|
|
|
|
println("FAIL: Area calculation incorrect")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
println("SUCCESS: Custom interface with private methods works correctly")
|
|
|
|
|
}
|