- Compiler: PP → Lexer → Parser → Analyzer → Gengo pipeline - Parser: 232/236 (98%) Harbour compatibility, registry-based dispatch - RTL: 351 Harbour-compatible functions - RDD: DBF/NTX/CDX engines with Rushmore bitmap optimization - Go Interop: IMPORT + pkg.Func() + obj:Method() with FastPath (15M calls/sec) - HB_FUNC API: Full Harbour C API compatible Go bridge - Concurrency: SPAWN/LAUNCH/GOROUTINE, <-, WATCH, PARALLEL FOR, ASYNC/AWAIT - Extensions: Multi-return, DEFER, Slice, f-string, Nil-safe ?:, CONST - Macro Compiler: Runtime AST parsing and evaluation - Debugger: TUI debugger with source display, breakpoints, stepping - FRB: Native + Pcode dual mode runtime binary - Tests: 13 packages ALL PASS Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
113 lines
2.1 KiB
Go
113 lines
2.1 KiB
Go
package hbrtl
|
|
|
|
import (
|
|
"five/hbrt"
|
|
"testing"
|
|
)
|
|
|
|
func TestHbIsArray(t *testing.T) {
|
|
_, th := setupVM()
|
|
th.PushValue(hbrt.MakeArray(3))
|
|
th.PendingParams2(1)
|
|
HbIsArray(th)
|
|
if !th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISARRAY({}) = false, want true")
|
|
}
|
|
|
|
th.PushString("not array")
|
|
th.PendingParams2(1)
|
|
HbIsArray(th)
|
|
if th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISARRAY('str') = true, want false")
|
|
}
|
|
}
|
|
|
|
func TestHbIsString(t *testing.T) {
|
|
_, th := setupVM()
|
|
th.PushString("hello")
|
|
th.PendingParams2(1)
|
|
HbIsChar(th)
|
|
if !th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISCHAR('hello') = false")
|
|
}
|
|
|
|
th.PushInt(42)
|
|
th.PendingParams2(1)
|
|
HbIsChar(th)
|
|
if th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISCHAR(42) = true")
|
|
}
|
|
}
|
|
|
|
func TestHbIsNumeric(t *testing.T) {
|
|
_, th := setupVM()
|
|
th.PushInt(42)
|
|
th.PendingParams2(1)
|
|
HbIsNumeric(th)
|
|
if !th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISNUMERIC(42) = false")
|
|
}
|
|
|
|
th.PushDouble(3.14, 5, 2)
|
|
th.PendingParams2(1)
|
|
HbIsNumeric(th)
|
|
if !th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISNUMERIC(3.14) = false")
|
|
}
|
|
|
|
th.PushString("nope")
|
|
th.PendingParams2(1)
|
|
HbIsNumeric(th)
|
|
if th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISNUMERIC('nope') = true")
|
|
}
|
|
}
|
|
|
|
func TestHbIsLogical(t *testing.T) {
|
|
_, th := setupVM()
|
|
th.PushBool(true)
|
|
th.PendingParams2(1)
|
|
HbIsLogical(th)
|
|
if !th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISLOGICAL(.T.) = false")
|
|
}
|
|
}
|
|
|
|
func TestHbIsNil(t *testing.T) {
|
|
_, th := setupVM()
|
|
th.PushNil()
|
|
th.PendingParams2(1)
|
|
HbIsNil(th)
|
|
if !th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISNIL(NIL) = false")
|
|
}
|
|
|
|
th.PushInt(0)
|
|
th.PendingParams2(1)
|
|
HbIsNil(th)
|
|
if th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISNIL(0) = true")
|
|
}
|
|
}
|
|
|
|
func TestHbIsHash(t *testing.T) {
|
|
_, th := setupVM()
|
|
th.PushValue(hbrt.MakeHash())
|
|
th.PendingParams2(1)
|
|
HbIsHash(th)
|
|
if !th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISHASH({=>}) = false")
|
|
}
|
|
}
|
|
|
|
func TestHbIsBlock(t *testing.T) {
|
|
_, th := setupVM()
|
|
blk := hbrt.MakeBlock(func(t *hbrt.Thread) {}, 0)
|
|
th.PushValue(blk)
|
|
th.PendingParams2(1)
|
|
HbIsBlock(th)
|
|
if !th.GetRetValue().AsBool() {
|
|
t.Error("HB_ISBLOCK(block) = false")
|
|
}
|
|
}
|