Packages

Multi-surface application runtime for Elixir. One TEA module renders to terminal, browser (LiveView), SSH, and MCP (agents). 30+ widgets, flexbox + CSS grid, AI agent runtime, distributed swarm with CRDTs, time-travel debugging, session recording, sandboxed REPL, and agentic commerce.

Current section

Files

Jump to
raxol lib termbox2_nif c_src termbox2 tests test_wcwidth test.php
Raw

lib/termbox2_nif/c_src/termbox2/tests/test_wcwidth/test.php

<?php
declare(strict_types=1);
setlocale(LC_ALL, 'C.UTF-8');
$libc = FFI::cdef('int wcwidth(int); int iswprint(int);');
$test->ffi->tb_init();
$mismatch = 0;
$test->ffi->quiet(true);
for ($c = 0; $c <= 0x10ffff; $c++) {
if ($test->ffi->tb_wcwidth($c) !== $libc->wcwidth($c)) {
++$mismatch;
}
if ((bool)$test->ffi->tb_iswprint($c) !== (bool)$libc->iswprint($c)) {
++$mismatch;
}
}
$test->ffi->quiet(false);
$test->ffi->tb_printf(0, 0, 0, 0, "mismatch=%d", $mismatch);
$test->ffi->tb_present();
$test->screencap();