Files
openchamber-android-native/third_party/mygo/native/internal/roundtrip/roundtrip_test.go
T
OpenChamber 6c0ee61750 feat: port the client to MyGo native UI (0.3.0)
Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
2026-11-18 13:22:59 +08:00

82 lines
1.8 KiB
Go

package roundtrip_test
import (
"context"
"strings"
"testing"
"github.com/egoist/mygo/native/internal/roundtrip"
"github.com/egoist/mygo/native/internal/roundtrip/check"
)
func echo(t testing.TB) roundtrip.Echo { return check.Echo(t) }
func TestScalars(t *testing.T) { check.Scalars(t) }
func TestText(t *testing.T) { check.Text(t) }
func TestRecord(t *testing.T) { check.Record(t) }
func TestLists(t *testing.T) { check.Lists(t) }
func TestMaybe(t *testing.T) { check.Maybe(t) }
func TestTimes(t *testing.T) { check.Times(t) }
func TestKinds(t *testing.T) { check.Kinds(t) }
func TestErrors(t *testing.T) { check.Errors(t) }
func TestAsync(t *testing.T) { check.Async(t) }
func TestStreams(t *testing.T) { check.Streams(t) }
func TestObjects(t *testing.T) { check.Objects(t) }
func TestCallbacks(t *testing.T) { check.Callbacks(t) }
func TestTicks(t *testing.T) { check.Ticks(t) }
func TestGoImplements(t *testing.T) { check.GoImplements(t) }
func TestBuffer(t *testing.T) { check.Buffer(t) }
func TestMore(t *testing.T) { check.More(t) }
// The cost of a call of each shape, which the encoding of values decides.
func BenchmarkAdd(b *testing.B) {
e := echo(b)
for b.Loop() {
e.Add(1, 2)
}
}
func BenchmarkText(b *testing.B) {
e := echo(b)
s := strings.Repeat("x", 100)
for b.Loop() {
e.Text(s, nil)
}
}
func BenchmarkRecord(b *testing.B) {
e := echo(b)
r := roundtrip.Record{Name: "r", Counts: []int{1, 2, 3, 4}, Tags: map[string]string{"a": "b"}, Next: &roundtrip.Inner{}, Kind: roundtrip.KindA, Data: make([]byte, 64)}
for b.Loop() {
if _, err := e.Record(r); err != nil {
b.Fatal(err)
}
}
}
func BenchmarkStream(b *testing.B) {
e := echo(b)
for b.Loop() {
for _, err := range e.Count(context.Background(), 100, -1) {
if err != nil {
b.Fatal(err)
}
}
}
}