Files
llgo/_demo/issue1370_geometry/geometry.go
xgopilot 85fd37e375 refactor: move issue #1370 regression tests from _cmptest to _demo
Move the three regression test cases for issue #1370 from _cmptest/ to _demo/:
- issue1370_gotypes (go/types.Object test)
- issue1370_goast (go/ast.Expr test)
- issue1370_geometry (custom interface test)

Updated import path in geometry.go to reflect new location.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-10-27 07:10:43 +00:00

33 lines
558 B
Go

package main
import (
"fmt"
"github.com/goplus/llgo/_demo/issue1370_geometry/geometry"
)
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")
}