ref: 43b4aa220b24cb13b45189c7eb3bbf01ac999d63
parent: 86ee68b31da8389a57874aa4c756188576fe1645
author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
date: Tue Mar 31 16:34:30 EDT 2026
rename test functions with descriptive suffixes, replacing numerical suffixes Agent-Logs-Url: https://github.com/yrk-lab/rd/sessions/72566556-7a90-4714-a2d3-44066253bbad Co-authored-by: yrk-lab <11537279+yrk-lab@users.noreply.github.com>
--- a/aud_test.c
+++ b/aud_test.c
@@ -4,8 +4,8 @@
int audiotests(void);
-static int testaudio1(void);
-static int testaudio2(void);
+static int testaudio_getfmt(void);
+static int testaudio_putfmt(void);
static char* pkt1 =
@@ -307,7 +307,7 @@
"4001";
static int
-testaudio1(){+testaudio_getfmt(){int n, nb;
uchar buf[1042];
Audiomsg r;
@@ -315,29 +315,29 @@
nb = dec16(buf, sizeof buf, pkt1, strlen(pkt1));
n = audiogetmsg(&r, buf, nb);
if(n < 0)
- sysfatal("testaudio1: unexpected error: %r\n");+ sysfatal("testaudio_getfmt: unexpected error: %r\n");if(n != 1042)
- sysfatal("testaudio1: len: want %d, got %d\n", 1042, n);+ sysfatal("testaudio_getfmt: len: want %d, got %d\n", 1042, n);if(r.type != Afmt)
- sysfatal("testaudio1: r.type: want 0x%x, got 0x%x\n",+ sysfatal("testaudio_getfmt: r.type: want 0x%x, got 0x%x\n",Afmt, r.type);
if(r.seq != 255)
- sysfatal("testaudio1: r.seq: want %ud, got %ud\n",+ sysfatal("testaudio_getfmt: r.seq: want %ud, got %ud\n",255, r.seq);
if(r.ver != 8)
- sysfatal("testaudio1: r.ver: want %ud, got %ud\n",+ sysfatal("testaudio_getfmt: r.ver: want %ud, got %ud\n",8, r.ver);
if(r.nfmt != 41)
- sysfatal("testaudio1: r.nfmt: want %ud, got %ud\n",+ sysfatal("testaudio_getfmt: r.nfmt: want %ud, got %ud\n",41, r.nfmt);
if(r.ndata != 1018)
- sysfatal("testaudio1: r.bdata: want %ud, got %ud\n",+ sysfatal("testaudio_getfmt: r.bdata: want %ud, got %ud\n",1018, r.ndata);
return 0;
}
static int
-testaudio2()
+testaudio_putfmt()
{int n;
char *s, *want;
@@ -347,15 +347,15 @@
m.type = Afmt;
n = audioputmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testaudio2: unexpected error: %r\n");+ sysfatal("testaudio_putfmt: unexpected error: %r\n"); s = smprint("%.*H", n, buf);want = "07002600" "01000000" "FFFFFFFF" "00000100"
"00000100" "00050000" "01000200" "44AC0000"
"10B10200" "04001000" "0000";
if(strcmp(s, want) != 0)
- sysfatal("testaudio2: want %s, got %s", want, s);+ sysfatal("testaudio_putfmt: want %s, got %s", want, s);if(n != strlen(want)/2)
- sysfatal("testaudio2: want %ld, got %d", strlen(want)/2, n);+ sysfatal("testaudio_putfmt: want %ld, got %d", strlen(want)/2, n);return 0;
}
@@ -364,7 +364,7 @@
{ fmtinstall('H', encodefmt);- testaudio1();
- testaudio2();
+ testaudio_getfmt();
+ testaudio_putfmt();
return 0;
}
--- a/mppc_test.c
+++ b/mppc_test.c
@@ -3,7 +3,7 @@
int mppctests(void);
static int
-testuncomp1(void)
+testuncomp_preset(void)
{/* Preset with no Pcompress: history is reset and input returned unchanged */
uchar input[] = {0x12, 0x34};@@ -12,16 +12,16 @@
out = uncomp(input, 2, 0x80, &psize); /* flags=Preset */
if(out == nil)
- sysfatal("testuncomp1: unexpected error: %r");+ sysfatal("testuncomp_preset: unexpected error: %r");if(out != input)
- sysfatal("testuncomp1: expected input buffer returned unchanged");+ sysfatal("testuncomp_preset: expected input buffer returned unchanged");if(psize != 2)
- sysfatal("testuncomp1: psize: want 2, got %d", psize);+ sysfatal("testuncomp_preset: psize: want 2, got %d", psize);return 0;
}
static int
-testuncomp2(void)
+testuncomp_preset_lit7(void)
{/*
* Preset + Pcompress: decompress two 7-bit literals.
@@ -33,11 +33,11 @@
out = uncomp(input, 2, 0x80|0x20, &psize); /* flags=Preset|Pcompress */
if(out == nil)
- sysfatal("testuncomp2: unexpected error: %r");+ sysfatal("testuncomp_preset_lit7: unexpected error: %r");if(psize != 2)
- sysfatal("testuncomp2: psize: want 2, got %d", psize);+ sysfatal("testuncomp_preset_lit7: psize: want 2, got %d", psize);if(out[0] != 'A' || out[1] != 'B')
- sysfatal("testuncomp2: data: want AB, got %c%c", out[0], out[1]);+ sysfatal("testuncomp_preset_lit7: data: want AB, got %c%c", out[0], out[1]);return 0;
}
@@ -278,8 +278,8 @@
int
mppctests(void)
{- testuncomp1();
- testuncomp2();
+ testuncomp_preset();
+ testuncomp_preset_lit7();
testuncomp_lit8();
testuncomp_off6();
testuncomp_off8();
--- a/msg_test.c
+++ b/msg_test.c
@@ -1,7 +1,7 @@
#include "msg.c"
static int
-testputmsg1(void){+testputmsg_xconnect(void){int n;
char *s, *want;
uchar buf[1042];
@@ -12,11 +12,11 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg1: unexpected error: %r\n");+ sysfatal("testputmsg_xconnect: unexpected error: %r\n"); s = smprint("%.*H", n, buf);want = "0300002722E00000000000436F6F6B69653A206D737473686173683D780D0A0100080001000000";
if(strcmp(s, want) != 0)
- sysfatal("testputmsg1: want %s, got %s", want, s);+ sysfatal("testputmsg_xconnect: want %s, got %s", want, s);free(s);
return 0;
@@ -23,7 +23,7 @@
}
static int
-testputmsg2(void){+testputmsg_xhangup(void){int n;
char *s, *want;
uchar buf[1042];
@@ -33,10 +33,10 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg2: unexpected error: %r\n");+ sysfatal("testputmsg_xhangup: unexpected error: %r\n"); s = smprint("%.*H", n, buf);if(strcmp(s, want = "03000007028080") != 0)
- sysfatal("testputmsg2: want %s, got %s", want, s);+ sysfatal("testputmsg_xhangup: want %s, got %s", want, s);free(s);
return 0;
@@ -43,7 +43,7 @@
}
static int
-testputmsg3(void){+testputmsg_mattach(void){int n;
char *s, *want;
uchar buf[1042];
@@ -53,10 +53,10 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg3: unexpected error: %r\n");+ sysfatal("testputmsg_mattach: unexpected error: %r\n"); s = smprint("%.*H", n, buf);if(strcmp(s, want = "0300000802F08028") != 0)
- sysfatal("testputmsg3: want %s, got %s", want, s);+ sysfatal("testputmsg_mattach: want %s, got %s", want, s);free(s);
return 0;
@@ -63,7 +63,7 @@
}
static int
-testputmsg4(void){+testputmsg_mjoin(void){int n;
char *s, *want;
uchar buf[1042];
@@ -75,10 +75,10 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg4: unexpected error: %r\n");+ sysfatal("testputmsg_mjoin: unexpected error: %r\n"); s = smprint("%.*H", n, buf);if(strcmp(s, want = "0300000C02F08038DEADBEEF") != 0)
- sysfatal("testputmsg4: want %s, got %s", want, s);+ sysfatal("testputmsg_mjoin: want %s, got %s", want, s);free(s);
return 0;
@@ -85,7 +85,7 @@
}
static int
-testputmsg5(void){+testputmsg_merectdom(void){int n;
char *s, *want;
uchar buf[1042];
@@ -94,11 +94,11 @@
m.type = Merectdom;
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg5: unexpected error: %r\n");+ sysfatal("testputmsg_merectdom: unexpected error: %r\n"); s = smprint("%.*H", n, buf);if(strcmp(s, want = "0300000C02F0800400010001") != 0)
- sysfatal("testputmsg5: want %s, got %s", want, s);+ sysfatal("testputmsg_merectdom: want %s, got %s", want, s);free(s);
return 0;
@@ -106,7 +106,7 @@
static int
-testputmsg6(void){+testputmsg_mconnect(void){int n;
char *s, *want;
uchar buf[1024];
@@ -129,14 +129,14 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg6: unexpected error: %r\n");+ sysfatal("testputmsg_mconnect: unexpected error: %r\n");want = "030001A602F0807F6582019A0401010401010101FF30200202002202020002020200000202000102020000020200010202FFFF020200023020020200010202000102020001020200010202000002020001020204200202000230200202FFFF0202FFFF0202FFFF0202000102020000020200010202FFFF0202000204820127000500147C0001811E000800100001C00044756361811001C0D800040008000004000301CA03AA09040000280A00005400530043004C00490045004E0054002D00540045005300540000000000000004000000000000000C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001CA01000000000018000F0003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007000100000002C00C00000000000000000004C00C00090000000000000003C0200002000000434C49505244520080000000524450445200000080000000";
s = smprint("%.*H", n, buf); if(strcmp(s, want) != 0){- fprint(2, "testputmsg6: want '%s', got '%s'\n", want, s);
- sysfatal("testputmsg6");+ fprint(2, "testputmsg_mconnect: want '%s', got '%s'\n", want, s);
+ sysfatal("testputmsg_mconnect");}
free(s);
return 0;
@@ -144,7 +144,7 @@
}
static int
-testputmsg7(void){+testputmsg_dclientinfo(void){int n;
char *s, *want;
uchar buf[4*1024];
@@ -161,14 +161,14 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg7: unexpected error: %r\n");+ sysfatal("testputmsg_dclientinfo: unexpected error: %r\n");want = "0300013302F08064BEEF03EB7081244000000000000000BB0300000E0010000C0018000600540045005300540044004F004D00000074006500730074007500730065007200000073006500630072006500740000006500780070006C006F007200650072002E00650078006500000043003A005C00000002000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000CE000000";
s = smprint("%.*H", n, buf); if(strcmp(s, want) != 0){- fprint(2, "testputmsg7: want '%s', got '%s'\n", want, s);
- sysfatal("testputmsg7");+ fprint(2, "testputmsg_dclientinfo: want '%s', got '%s'\n", want, s);
+ sysfatal("testputmsg_dclientinfo");}
free(s);
return 0;
@@ -176,7 +176,7 @@
}
static int
-testputmsg8(void){+testputmsg_mactivated(void){int n;
char *s, *want;
uchar buf[1042];
@@ -191,14 +191,14 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg8: unexpected error: %r\n");+ sysfatal("testputmsg_mactivated: unexpected error: %r\n");want = "0300018402F08064BBBB03EB70817575011300BBBBCCCC0000AAAA07005E01506C616E2039000800000001001800000000000002000200000504000000000000000002001E000000010001000100000458020000010001000000010000000002030058000000000000000000000000000000000000000000010014000000010000006A000000010100000000000000000000000000000000000000000000000000000000A1060000000000000084030000000000E40004001300280000000003780000007800000050010000000000000000000000000000000000000000000008000800000014000D005800110000000904000004000000000000000C000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C00080000000000140008000000000010003400FE000400FE000400FE000800FE000800FE001000FE002000FE004000FE008000FE000001400000080001000100000000";
s = smprint("%.*H", n, buf); if(strcmp(s, want) != 0){- fprint(2, "testputmsg8: want '%s', got '%s'\n", want, s);
- sysfatal("testputmsg8");+ fprint(2, "testputmsg_mactivated: want '%s', got '%s'\n", want, s);
+ sysfatal("testputmsg_mactivated");}
free(s);
return 0;
@@ -206,7 +206,7 @@
}
static int
-testputmsg9(void){+testputmsg_mvchan(void){int n;
char *s, *want;
uchar buf[1042];
@@ -227,19 +227,19 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg9: unexpected error: %r\n");+ sysfatal("testputmsg_mvchan: unexpected error: %r\n");want = "0300001E02F080641111222270800F070000001300000061626364656667";
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg9: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_mvchan: want '%s', got '%s'", want, s);free(s);
return 0;
}
static int
-testputmsg10(void){+testputmsg_async(void){int n;
char *s, *want;
uchar buf[512];
@@ -252,19 +252,19 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg10: unexpected error: %r\n");+ sysfatal("testputmsg_async: unexpected error: %r\n");want = "0300002502F08064222203EB70801616001700222233330000000116001F00000001001111";
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg10: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_async: want '%s', got '%s'", want, s);free(s);
return 0;
}
static int
-testputmsg11(void){+testputmsg_actl_cooperate(void){int n;
char *s, *want;
uchar buf[1024];
@@ -272,19 +272,19 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg11: unexpected error: %r\n");+ sysfatal("testputmsg_actl_cooperate: unexpected error: %r\n");want = "0300002902F08064111103EB70801A1A00170011112222000000011A00140000000400000000000000";
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg11: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_actl_cooperate: want '%s', got '%s'", want, s);free(s);
return 0;
}
static int
-testputmsg12(void){+testputmsg_actl_reqctl(void){int n;
char *s, *want;
uchar buf[1024];
@@ -292,19 +292,19 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg12: unexpected error: %r\n");+ sysfatal("testputmsg_actl_reqctl: unexpected error: %r\n");want = "0300002902F08064333303EB70801A1A00170033334444000000011A00140000000100000000000000";
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg12: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_actl_reqctl: want '%s', got '%s'", want, s);free(s);
return 0;
}
static int
-testputmsg13(void){+testputmsg_afontls(void){int n;
char *s, *want;
uchar buf[1024];
@@ -312,19 +312,19 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg13: unexpected error: %r\n");+ sysfatal("testputmsg_afontls: unexpected error: %r\n");want = "0300002902F08064444403EB70801A1A00170044445555000000011A00270000000000000003003200";
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg13: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_afontls: want '%s', got '%s'", want, s);free(s);
return 0;
}
static int
-testputmsg14(void){+testputmsg_ainput_sync(void){int n;
char *s, *want;
uchar buf[1042];
@@ -341,13 +341,13 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg14: unexpected error: %r\n");+ sysfatal("testputmsg_ainput_sync: unexpected error: %r\n");want = "0300003102F08064111103EB70802222001700111122220000000122001C00000001000000000000000000000000000000";
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg14: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_ainput_sync: want '%s', got '%s'", want, s);free(s);
return 0;
@@ -354,7 +354,7 @@
}
static int
-testputmsg15(void){+testputmsg_ainput_keycode(void){int n;
char *s, *want;
uchar buf[1042];
@@ -374,13 +374,13 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg15: unexpected error: %r\n");+ sysfatal("testputmsg_ainput_keycode: unexpected error: %r\n");want = "0300003102F08064111103EB70802222001700111122220000000122001C0000000100000033330000040044002A000000";
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg15: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_ainput_keycode: want '%s', got '%s'", want, s);free(s);
return 0;
@@ -387,7 +387,7 @@
}
static int
-testputmsg16(void){+testputmsg_lreq(void){int n;
char *s, *want;
uchar buf[2*1024];
@@ -396,7 +396,7 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg16: unexpected error: %r\n");+ sysfatal("testputmsg_lreq: unexpected error: %r\n");want =
// TPKT header
@@ -450,8 +450,8 @@
s = smprint("%.*H", n, buf); if(strcmp(s, want) != 0){- fprint(2, "testputmsg16: want '%s', got '%s'\n", want, s);
- sysfatal("testputmsg16");+ fprint(2, "testputmsg_lreq: want '%s', got '%s'\n", want, s);
+ sysfatal("testputmsg_lreq");}
free(s);
return 0;
@@ -458,7 +458,7 @@
}
static int
-testputmsg17(void){+testputmsg_lnolicense(void){int n;
char *s, *want;
uchar buf[1024];
@@ -466,7 +466,7 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg17: unexpected error: %r\n");+ sysfatal("testputmsg_lnolicense: unexpected error: %r\n");want =
"0300002302F08064111103EB70801480000000FF031000020000000100000004000000";
@@ -473,13 +473,13 @@
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg17: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_lnolicense: want '%s', got '%s'", want, s);free(s);
return 0;
}
static int
-testputmsg18(void){+testputmsg_dsupress(void){int n;
char *s, *want;
uchar buf[512];
@@ -494,7 +494,7 @@
n = putmsg(buf, sizeof buf, &m);
if(n < 0)
- sysfatal("testputmsg18: unexpected error: %r\n");+ sysfatal("testputmsg_dsupress: unexpected error: %r\n");want =
"0300002D02F08064222203EB70801E1E00170022223333000000011E00230000000100000000000000FF041F03";
@@ -501,7 +501,7 @@
s = smprint("%.*H", n, buf);if(strcmp(s, want) != 0)
- sysfatal("testputmsg18: want '%s', got '%s'", want, s);+ sysfatal("testputmsg_dsupress: want '%s', got '%s'", want, s);free(s);
return 0;
}
@@ -508,7 +508,7 @@
static int
-testgetmsg1(void)
+testgetmsg_fp2(void)
{/* Fast-path update: 2-byte length header */
int n, nb;
@@ -519,18 +519,18 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg1: unexpected error: %r");+ sysfatal("testgetmsg_fp2: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg1: type: want %d, got %d", Aupdate, m.type);+ sysfatal("testgetmsg_fp2: type: want %d, got %d", Aupdate, m.type);if(m.ndata != 4)
- sysfatal("testgetmsg1: ndata: want 4, got %d", m.ndata);+ sysfatal("testgetmsg_fp2: ndata: want 4, got %d", m.ndata);if(m.getshare != getshareF)
- sysfatal("testgetmsg1: getshare: expected getshareF");+ sysfatal("testgetmsg_fp2: getshare: expected getshareF");return 0;
}
static int
-testgetmsg2(void)
+testgetmsg_fp3(void)
{/* Fast-path update: 3-byte length header */
int n, nb;
@@ -541,18 +541,18 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg2: unexpected error: %r");+ sysfatal("testgetmsg_fp3: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg2: type: want %d, got %d", Aupdate, m.type);+ sysfatal("testgetmsg_fp3: type: want %d, got %d", Aupdate, m.type);if(m.ndata != 3)
- sysfatal("testgetmsg2: ndata: want 3, got %d", m.ndata);+ sysfatal("testgetmsg_fp3: ndata: want 3, got %d", m.ndata);if(m.getshare != getshareF)
- sysfatal("testgetmsg2: getshare: expected getshareF");+ sysfatal("testgetmsg_fp3: getshare: expected getshareF");return 0;
}
static int
-testgetmsg3(void)
+testgetmsg_xconnected_tls(void)
{/* X.224 connection confirm with TLS negotiation response */
int n, nb;
@@ -563,16 +563,16 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg3: unexpected error: %r");+ sysfatal("testgetmsg_xconnected_tls: unexpected error: %r");if(m.type != Xconnected)
- sysfatal("testgetmsg3: type: want %d, got %d", Xconnected, m.type);+ sysfatal("testgetmsg_xconnected_tls: type: want %d, got %d", Xconnected, m.type);if(m.negproto != ProtoTLS)
- sysfatal("testgetmsg3: negproto: want %d (ProtoTLS), got %d", ProtoTLS, m.negproto);+ sysfatal("testgetmsg_xconnected_tls: negproto: want %d (ProtoTLS), got %d", ProtoTLS, m.negproto);return 0;
}
static int
-testgetmsg4(void)
+testgetmsg_xconnected_nonego(void)
{/* X.224 connection confirm with non-matching nego type: negproto stays 0 */
int n, nb;
@@ -583,16 +583,16 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg4: unexpected error: %r");+ sysfatal("testgetmsg_xconnected_nonego: unexpected error: %r");if(m.type != Xconnected)
- sysfatal("testgetmsg4: type: want %d, got %d", Xconnected, m.type);+ sysfatal("testgetmsg_xconnected_nonego: type: want %d, got %d", Xconnected, m.type);if(m.negproto != 0)
- sysfatal("testgetmsg4: negproto: want 0, got %d", m.negproto);+ sysfatal("testgetmsg_xconnected_nonego: negproto: want 0, got %d", m.negproto);return 0;
}
static int
-testgetmsg5(void)
+testgetmsg_mattached_uid(void)
{/* MCS Attach User Confirm with userId present */
int n, nb;
@@ -603,16 +603,16 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg5: unexpected error: %r");+ sysfatal("testgetmsg_mattached_uid: unexpected error: %r");if(m.type != Mattached)
- sysfatal("testgetmsg5: type: want %d, got %d", Mattached, m.type);+ sysfatal("testgetmsg_mattached_uid: type: want %d, got %d", Mattached, m.type);if(m.mcsuid != 0xBEEF)
- sysfatal("testgetmsg5: mcsuid: want 0xBEEF, got 0x%X", m.mcsuid);+ sysfatal("testgetmsg_mattached_uid: mcsuid: want 0xBEEF, got 0x%X", m.mcsuid);return 0;
}
static int
-testgetmsg6(void)
+testgetmsg_mattached_nouid(void)
{/* MCS Attach User Confirm without userId */
int n, nb;
@@ -623,16 +623,16 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg6: unexpected error: %r");+ sysfatal("testgetmsg_mattached_nouid: unexpected error: %r");if(m.type != Mattached)
- sysfatal("testgetmsg6: type: want %d, got %d", Mattached, m.type);+ sysfatal("testgetmsg_mattached_nouid: type: want %d, got %d", Mattached, m.type);if(m.mcsuid != 0)
- sysfatal("testgetmsg6: mcsuid: want 0, got 0x%X", m.mcsuid);+ sysfatal("testgetmsg_mattached_nouid: mcsuid: want 0, got 0x%X", m.mcsuid);return 0;
}
static int
-testgetmsg7(void)
+testgetmsg_mjoined(void)
{/* MCS Channel Join Confirm */
int n, nb;
@@ -643,14 +643,14 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg7: unexpected error: %r");+ sysfatal("testgetmsg_mjoined: unexpected error: %r");if(m.type != Mjoined)
- sysfatal("testgetmsg7: type: want %d, got %d", Mjoined, m.type);+ sysfatal("testgetmsg_mjoined: type: want %d, got %d", Mjoined, m.type);return 0;
}
static int
-testgetmsg8(void)
+testgetmsg_mclosing(void)
{/* Disconnect Provider Ultimatum */
int n, nb;
@@ -661,14 +661,14 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg8: unexpected error: %r");+ sysfatal("testgetmsg_mclosing: unexpected error: %r");if(m.type != Mclosing)
- sysfatal("testgetmsg8: type: want %d, got %d", Mclosing, m.type);+ sysfatal("testgetmsg_mclosing: type: want %d, got %d", Mclosing, m.type);return 0;
}
static int
-testgetmsg9(void)
+testgetmsg_mvchan(void)
{/* MCS virtual channel data (non-global channel) */
int n, nb;
@@ -679,24 +679,24 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg9: unexpected error: %r");+ sysfatal("testgetmsg_mvchan: unexpected error: %r");if(m.type != Mvchan)
- sysfatal("testgetmsg9: type: want %d, got %d", Mvchan, m.type);+ sysfatal("testgetmsg_mvchan: type: want %d, got %d", Mvchan, m.type);if(m.chanid != 0x2222)
- sysfatal("testgetmsg9: chanid: want 0x2222, got 0x%X", m.chanid);+ sysfatal("testgetmsg_mvchan: chanid: want 0x2222, got 0x%X", m.chanid);if(m.len != 7)
- sysfatal("testgetmsg9: len: want 7, got %d", m.len);+ sysfatal("testgetmsg_mvchan: len: want 7, got %d", m.len);if(m.flags != 0x13)
- sysfatal("testgetmsg9: flags: want 0x13, got 0x%lX", m.flags);+ sysfatal("testgetmsg_mvchan: flags: want 0x13, got 0x%lX", m.flags);if(m.ndata != 7)
- sysfatal("testgetmsg9: ndata: want 7, got %d", m.ndata);+ sysfatal("testgetmsg_mvchan: ndata: want 7, got %d", m.ndata);if(memcmp(m.data, "abcdefg", 7) != 0)
- sysfatal("testgetmsg9: data mismatch");+ sysfatal("testgetmsg_mvchan: data mismatch");return 0;
}
static int
-testgetmsg10(void)
+testgetmsg_sp_update(void)
{/* Slow-path update on global channel */
int n, nb;
@@ -707,18 +707,18 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg10: unexpected error: %r");+ sysfatal("testgetmsg_sp_update: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg10: type: want %d, got %d", Aupdate, m.type);+ sysfatal("testgetmsg_sp_update: type: want %d, got %d", Aupdate, m.type);if(m.ndata != 4)
- sysfatal("testgetmsg10: ndata: want 4, got %d", m.ndata);+ sysfatal("testgetmsg_sp_update: ndata: want 4, got %d", m.ndata);if(m.getshare != getshareT)
- sysfatal("testgetmsg10: getshare: expected getshareT");+ sysfatal("testgetmsg_sp_update: getshare: expected getshareT");return 0;
}
static int
-testgetmsg11(void)
+testgetmsg_mattach_err(void)
{/* Error: MCS Attach User Confirm with non-zero error result */
int n, nb;
@@ -729,12 +729,12 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n >= 0)
- sysfatal("testgetmsg11: expected error, got %d", n);+ sysfatal("testgetmsg_mattach_err: expected error, got %d", n);return 0;
}
static int
-testgetmsg12(void)
+testgetmsg_mjoin_err(void)
{/* Error: MCS Channel Join Confirm with non-zero error result */
int n, nb;
@@ -745,12 +745,12 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n >= 0)
- sysfatal("testgetmsg12: expected error, got %d", n);+ sysfatal("testgetmsg_mjoin_err: expected error, got %d", n);return 0;
}
static int
-testgetmsg13(void)
+testgetmsg_fp_encr_err(void)
{/* Error: legacy encryption in fast-path PDU */
int n, nb;
@@ -761,12 +761,12 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n >= 0)
- sysfatal("testgetmsg13: expected error, got %d", n);+ sysfatal("testgetmsg_fp_encr_err: expected error, got %d", n);return 0;
}
static int
-testgetmsg14(void)
+testgetmsg_aflow(void)
{/* Flow PDU on global channel (isflowpdu): GSHORT = 0x8000 → Aflow */
int n, nb;
@@ -777,14 +777,14 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg14: unexpected error: %r");+ sysfatal("testgetmsg_aflow: unexpected error: %r");if(m.type != Aflow)
- sysfatal("testgetmsg14: type: want %d (Aflow), got %d", Aflow, m.type);+ sysfatal("testgetmsg_aflow: type: want %d (Aflow), got %d", Aflow, m.type);return 0;
}
static int
-testgetmsg15(void)
+testgetmsg_licensepk_sctlv1(void)
{/*
* Slow-path on global channel with Slicensepk flag but sctlver==1.
@@ -799,18 +799,18 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg15: unexpected error: %r");+ sysfatal("testgetmsg_licensepk_sctlv1: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg15: type: want %d (Aupdate), got %d", Aupdate, m.type);+ sysfatal("testgetmsg_licensepk_sctlv1: type: want %d (Aupdate), got %d", Aupdate, m.type);if(m.ndata != 4)
- sysfatal("testgetmsg15: ndata: want 4, got %d", m.ndata);+ sysfatal("testgetmsg_licensepk_sctlv1: ndata: want 4, got %d", m.ndata);if(m.getshare != getshareT)
- sysfatal("testgetmsg15: getshare: expected getshareT");+ sysfatal("testgetmsg_licensepk_sctlv1: getshare: expected getshareT");return 0;
}
static int
-testgetmsg16(void)
+testgetmsg_ldone(void)
{/* License PDU with Notify (0xFF) type → Ldone */
int n, nb;
@@ -821,14 +821,14 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg16: unexpected error: %r");+ sysfatal("testgetmsg_ldone: unexpected error: %r");if(m.type != Ldone)
- sysfatal("testgetmsg16: type: want %d (Ldone), got %d", Ldone, m.type);+ sysfatal("testgetmsg_ldone: type: want %d (Ldone), got %d", Ldone, m.type);return 0;
}
static int
-testgetmsg17(void)
+testgetmsg_lneedlicense(void)
{/* License PDU with SNeedLicense (0x01) type → Lneedlicense */
int n, nb;
@@ -839,14 +839,14 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg17: unexpected error: %r");+ sysfatal("testgetmsg_lneedlicense: unexpected error: %r");if(m.type != Lneedlicense)
- sysfatal("testgetmsg17: type: want %d (Lneedlicense), got %d", Lneedlicense, m.type);+ sysfatal("testgetmsg_lneedlicense: type: want %d (Lneedlicense), got %d", Lneedlicense, m.type);return 0;
}
static int
-testgetmsg18(void)
+testgetmsg_lhavechal(void)
{/* License PDU with SHaveChal (0x02) type → Lhavechal */
int n, nb;
@@ -857,14 +857,14 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg18: unexpected error: %r");+ sysfatal("testgetmsg_lhavechal: unexpected error: %r");if(m.type != Lhavechal)
- sysfatal("testgetmsg18: type: want %d (Lhavechal), got %d", Lhavechal, m.type);+ sysfatal("testgetmsg_lhavechal: type: want %d (Lhavechal), got %d", Lhavechal, m.type);return 0;
}
static int
-testgetmsg19(void)
+testgetmsg_sp_deactivate(void)
{/*
* Slow-path Deactivate All PDU (PDUdeactivate=6) on global channel:
@@ -885,21 +885,21 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg19: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_sp_deactivate: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg19: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_sp_deactivate: type: want Aupdate, got %d", m.type);if(m.getshare != getshareT)
- sysfatal("testgetmsg19: getshare: expected getshareT");+ sysfatal("testgetmsg_sp_deactivate: getshare: expected getshareT");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg19: getshare: unexpected error: %r");+ sysfatal("testgetmsg_sp_deactivate: getshare: unexpected error: %r");if(u.type != ShDeactivate)
- sysfatal("testgetmsg19: share type: want ShDeactivate (%d), got %d", ShDeactivate, u.type);+ sysfatal("testgetmsg_sp_deactivate: share type: want ShDeactivate (%d), got %d", ShDeactivate, u.type);return 0;
}
static int
-testgetmsg20(void)
+testgetmsg_sp_einfo(void)
{/*
* Slow-path Set Error Info PDU (ADerrx=47) on global channel:
@@ -924,23 +924,23 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg20: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_sp_einfo: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg20: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_sp_einfo: type: want Aupdate, got %d", m.type);if(m.getshare != getshareT)
- sysfatal("testgetmsg20: getshare: expected getshareT");+ sysfatal("testgetmsg_sp_einfo: getshare: expected getshareT");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg20: getshare: unexpected error: %r");+ sysfatal("testgetmsg_sp_einfo: getshare: unexpected error: %r");if(u.type != ShEinfo)
- sysfatal("testgetmsg20: share type: want ShEinfo (%d), got %d", ShEinfo, u.type);+ sysfatal("testgetmsg_sp_einfo: share type: want ShEinfo (%d), got %d", ShEinfo, u.type);if(u.err != 0x1234)
- sysfatal("testgetmsg20: err: want 0x1234, got 0x%X", u.err);+ sysfatal("testgetmsg_sp_einfo: err: want 0x1234, got 0x%X", u.err);return 0;
}
static int
-testgetmsg21(void)
+testgetmsg_sp_orders(void)
{/*
* Slow-path Drawing Orders update (ADdraw/UpdOrders=0) on global channel:
@@ -965,23 +965,23 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg21: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_sp_orders: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg21: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_sp_orders: type: want Aupdate, got %d", m.type);if(m.getshare != getshareT)
- sysfatal("testgetmsg21: getshare: expected getshareT");+ sysfatal("testgetmsg_sp_orders: getshare: expected getshareT");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg21: getshare: unexpected error: %r");+ sysfatal("testgetmsg_sp_orders: getshare: unexpected error: %r");if(u.type != ShUorders)
- sysfatal("testgetmsg21: share type: want ShUorders (%d), got %d", ShUorders, u.type);+ sysfatal("testgetmsg_sp_orders: share type: want ShUorders (%d), got %d", ShUorders, u.type);if(u.nr != 3)
- sysfatal("testgetmsg21: nr: want 3, got %d", u.nr);+ sysfatal("testgetmsg_sp_orders: nr: want 3, got %d", u.nr);return 0;
}
static int
-testgetmsg22(void)
+testgetmsg_sp_bitmap(void)
{/*
* Slow-path Bitmap Update (ADdraw/UpdBitmap=1) on global channel:
@@ -1006,23 +1006,23 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg22: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_sp_bitmap: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg22: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_sp_bitmap: type: want Aupdate, got %d", m.type);if(m.getshare != getshareT)
- sysfatal("testgetmsg22: getshare: expected getshareT");+ sysfatal("testgetmsg_sp_bitmap: getshare: expected getshareT");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg22: getshare: unexpected error: %r");+ sysfatal("testgetmsg_sp_bitmap: getshare: unexpected error: %r");if(u.type != ShUimg)
- sysfatal("testgetmsg22: share type: want ShUimg (%d), got %d", ShUimg, u.type);+ sysfatal("testgetmsg_sp_bitmap: share type: want ShUimg (%d), got %d", ShUimg, u.type);if(u.nr != 2)
- sysfatal("testgetmsg22: nr: want 2, got %d", u.nr);+ sysfatal("testgetmsg_sp_bitmap: nr: want 2, got %d", u.nr);return 0;
}
static int
-testgetmsg23(void)
+testgetmsg_sp_cmap(void)
{/*
* Slow-path Color Table Cache Update (ADdraw/UpdCmap=2) on global channel:
@@ -1047,21 +1047,21 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg23: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_sp_cmap: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg23: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_sp_cmap: type: want Aupdate, got %d", m.type);if(m.getshare != getshareT)
- sysfatal("testgetmsg23: getshare: expected getshareT");+ sysfatal("testgetmsg_sp_cmap: getshare: expected getshareT");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg23: getshare: unexpected error: %r");+ sysfatal("testgetmsg_sp_cmap: getshare: unexpected error: %r");if(u.type != ShUcmap)
- sysfatal("testgetmsg23: share type: want ShUcmap (%d), got %d", ShUcmap, u.type);+ sysfatal("testgetmsg_sp_cmap: share type: want ShUcmap (%d), got %d", ShUcmap, u.type);return 0;
}
static int
-testgetmsg24(void)
+testgetmsg_sp_warp(void)
{/*
* Slow-path Pointer Position Update (ADcursor/PDUcursorwarp=3) on global channel:
@@ -1086,25 +1086,25 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg24: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_sp_warp: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg24: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_sp_warp: type: want Aupdate, got %d", m.type);if(m.getshare != getshareT)
- sysfatal("testgetmsg24: getshare: expected getshareT");+ sysfatal("testgetmsg_sp_warp: getshare: expected getshareT");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg24: getshare: unexpected error: %r");+ sysfatal("testgetmsg_sp_warp: getshare: unexpected error: %r");if(u.type != ShUwarp)
- sysfatal("testgetmsg24: share type: want ShUwarp (%d), got %d", ShUwarp, u.type);+ sysfatal("testgetmsg_sp_warp: share type: want ShUwarp (%d), got %d", ShUwarp, u.type);if(u.x != 100)
- sysfatal("testgetmsg24: x: want 100, got %d", u.x);+ sysfatal("testgetmsg_sp_warp: x: want 100, got %d", u.x);if(u.y != 200)
- sysfatal("testgetmsg24: y: want 200, got %d", u.y);+ sysfatal("testgetmsg_sp_warp: y: want 200, got %d", u.y);return 0;
}
static int
-testgetmsg25(void)
+testgetmsg_fp_orders(void)
{/*
* Fast-path Drawing Orders update (FUpdOrders=0):
@@ -1120,23 +1120,23 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg25: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_fp_orders: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg25: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_fp_orders: type: want Aupdate, got %d", m.type);if(m.getshare != getshareF)
- sysfatal("testgetmsg25: getshare: expected getshareF");+ sysfatal("testgetmsg_fp_orders: getshare: expected getshareF");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg25: getshare: unexpected error: %r");+ sysfatal("testgetmsg_fp_orders: getshare: unexpected error: %r");if(u.type != ShUorders)
- sysfatal("testgetmsg25: share type: want ShUorders (%d), got %d", ShUorders, u.type);+ sysfatal("testgetmsg_fp_orders: share type: want ShUorders (%d), got %d", ShUorders, u.type);if(u.nr != 5)
- sysfatal("testgetmsg25: nr: want 5, got %d", u.nr);+ sysfatal("testgetmsg_fp_orders: nr: want 5, got %d", u.nr);return 0;
}
static int
-testgetmsg26(void)
+testgetmsg_fp_bitmap(void)
{/*
* Fast-path Bitmap Update (FUpdBitmap=1):
@@ -1152,23 +1152,23 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg26: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_fp_bitmap: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg26: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_fp_bitmap: type: want Aupdate, got %d", m.type);if(m.getshare != getshareF)
- sysfatal("testgetmsg26: getshare: expected getshareF");+ sysfatal("testgetmsg_fp_bitmap: getshare: expected getshareF");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg26: getshare: unexpected error: %r");+ sysfatal("testgetmsg_fp_bitmap: getshare: unexpected error: %r");if(u.type != ShUimg)
- sysfatal("testgetmsg26: share type: want ShUimg (%d), got %d", ShUimg, u.type);+ sysfatal("testgetmsg_fp_bitmap: share type: want ShUimg (%d), got %d", ShUimg, u.type);if(u.nr != 3)
- sysfatal("testgetmsg26: nr: want 3, got %d", u.nr);+ sysfatal("testgetmsg_fp_bitmap: nr: want 3, got %d", u.nr);return 0;
}
static int
-testgetmsg27(void)
+testgetmsg_fp_cmap(void)
{/*
* Fast-path Color Table Cache Update (FUpdCmap=2):
@@ -1184,21 +1184,21 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg27: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_fp_cmap: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg27: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_fp_cmap: type: want Aupdate, got %d", m.type);if(m.getshare != getshareF)
- sysfatal("testgetmsg27: getshare: expected getshareF");+ sysfatal("testgetmsg_fp_cmap: getshare: expected getshareF");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg27: getshare: unexpected error: %r");+ sysfatal("testgetmsg_fp_cmap: getshare: unexpected error: %r");if(u.type != ShUcmap)
- sysfatal("testgetmsg27: share type: want ShUcmap (%d), got %d", ShUcmap, u.type);+ sysfatal("testgetmsg_fp_cmap: share type: want ShUcmap (%d), got %d", ShUcmap, u.type);return 0;
}
static int
-testgetmsg28(void)
+testgetmsg_fp_warp(void)
{/*
* Fast-path Pointer Position Update (FUpdWarp=8):
@@ -1214,25 +1214,25 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetmsg28: getmsg: unexpected error: %r");+ sysfatal("testgetmsg_fp_warp: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetmsg28: type: want Aupdate, got %d", m.type);+ sysfatal("testgetmsg_fp_warp: type: want Aupdate, got %d", m.type);if(m.getshare != getshareF)
- sysfatal("testgetmsg28: getshare: expected getshareF");+ sysfatal("testgetmsg_fp_warp: getshare: expected getshareF");n = m.getshare(&u, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetmsg28: getshare: unexpected error: %r");+ sysfatal("testgetmsg_fp_warp: getshare: unexpected error: %r");if(u.type != ShUwarp)
- sysfatal("testgetmsg28: share type: want ShUwarp (%d), got %d", ShUwarp, u.type);+ sysfatal("testgetmsg_fp_warp: share type: want ShUwarp (%d), got %d", ShUwarp, u.type);if(u.x != 100)
- sysfatal("testgetmsg28: x: want 100, got %d", u.x);+ sysfatal("testgetmsg_fp_warp: x: want 100, got %d", u.x);if(u.y != 200)
- sysfatal("testgetmsg28: y: want 200, got %d", u.y);+ sysfatal("testgetmsg_fp_warp: y: want 200, got %d", u.y);return 0;
}
static int
-testgetcaps1(void)
+testgetcaps_general_bitmap(void)
{/*
* Server Demand Active PDU containing two capability sets:
@@ -1270,33 +1270,33 @@
nb = dec16(buf, sizeof buf, hex, strlen(hex));
n = getmsg(&m, buf, nb);
if(n <= 0)
- sysfatal("testgetcaps1: getmsg: unexpected error: %r");+ sysfatal("testgetcaps_general_bitmap: getmsg: unexpected error: %r");if(m.type != Aupdate)
- sysfatal("testgetcaps1: type: want Aupdate, got %d", m.type);+ sysfatal("testgetcaps_general_bitmap: type: want Aupdate, got %d", m.type);if(m.getshare != getshareT)
- sysfatal("testgetcaps1: getshare: expected getshareT");+ sysfatal("testgetcaps_general_bitmap: getshare: expected getshareT");n = m.getshare(&as, m.data, m.ndata);
if(n <= 0)
- sysfatal("testgetcaps1: getshare: unexpected error: %r");+ sysfatal("testgetcaps_general_bitmap: getshare: unexpected error: %r");if(as.type != ShActivate)
- sysfatal("testgetcaps1: share type: want ShActivate, got %d", as.type);+ sysfatal("testgetcaps_general_bitmap: share type: want ShActivate, got %d", as.type);n = getcaps(&caps, as.data, as.ndata);
if(n < 0)
- sysfatal("testgetcaps1: getcaps: unexpected error: %r");+ sysfatal("testgetcaps_general_bitmap: getcaps: unexpected error: %r");if(!caps.general)
- sysfatal("testgetcaps1: caps.general: want 1, got 0");+ sysfatal("testgetcaps_general_bitmap: caps.general: want 1, got 0");if(caps.canrefresh != 1)
- sysfatal("testgetcaps1: canrefresh: want 1, got %d", caps.canrefresh);+ sysfatal("testgetcaps_general_bitmap: canrefresh: want 1, got %d", caps.canrefresh);if(caps.cansupress != 1)
- sysfatal("testgetcaps1: cansupress: want 1, got %d", caps.cansupress);+ sysfatal("testgetcaps_general_bitmap: cansupress: want 1, got %d", caps.cansupress);if(!caps.bitmap)
- sysfatal("testgetcaps1: caps.bitmap: want 1, got 0");+ sysfatal("testgetcaps_general_bitmap: caps.bitmap: want 1, got 0");if(caps.depth != 32)
- sysfatal("testgetcaps1: depth: want 32, got %d", caps.depth);+ sysfatal("testgetcaps_general_bitmap: depth: want 32, got %d", caps.depth);if(caps.xsz != 1024)
- sysfatal("testgetcaps1: xsz: want 1024, got %d", caps.xsz);+ sysfatal("testgetcaps_general_bitmap: xsz: want 1024, got %d", caps.xsz);if(caps.ysz != 768)
- sysfatal("testgetcaps1: ysz: want 768, got %d", caps.ysz);+ sysfatal("testgetcaps_general_bitmap: ysz: want 768, got %d", caps.ysz);return 0;
}
@@ -1304,52 +1304,52 @@
msgtests(void)
{ fmtinstall('H', encodefmt);- testputmsg1();
- testputmsg2();
- testputmsg3();
- testputmsg4();
- testputmsg5();
- testputmsg6();
- testputmsg7();
- testputmsg8();
- testputmsg9();
- testputmsg10();
- testputmsg11();
- testputmsg12();
- testputmsg13();
- testputmsg14();
- testputmsg15();
- testputmsg16();
- testputmsg17();
- testputmsg18();
- testgetmsg1();
- testgetmsg2();
- testgetmsg3();
- testgetmsg4();
- testgetmsg5();
- testgetmsg6();
- testgetmsg7();
- testgetmsg8();
- testgetmsg9();
- testgetmsg10();
- testgetmsg11();
- testgetmsg12();
- testgetmsg13();
- testgetmsg14();
- testgetmsg15();
- testgetmsg16();
- testgetmsg17();
- testgetmsg18();
- testgetmsg19();
- testgetmsg20();
- testgetmsg21();
- testgetmsg22();
- testgetmsg23();
- testgetmsg24();
- testgetmsg25();
- testgetmsg26();
- testgetmsg27();
- testgetmsg28();
- testgetcaps1();
+ testputmsg_xconnect();
+ testputmsg_xhangup();
+ testputmsg_mattach();
+ testputmsg_mjoin();
+ testputmsg_merectdom();
+ testputmsg_mconnect();
+ testputmsg_dclientinfo();
+ testputmsg_mactivated();
+ testputmsg_mvchan();
+ testputmsg_async();
+ testputmsg_actl_cooperate();
+ testputmsg_actl_reqctl();
+ testputmsg_afontls();
+ testputmsg_ainput_sync();
+ testputmsg_ainput_keycode();
+ testputmsg_lreq();
+ testputmsg_lnolicense();
+ testputmsg_dsupress();
+ testgetmsg_fp2();
+ testgetmsg_fp3();
+ testgetmsg_xconnected_tls();
+ testgetmsg_xconnected_nonego();
+ testgetmsg_mattached_uid();
+ testgetmsg_mattached_nouid();
+ testgetmsg_mjoined();
+ testgetmsg_mclosing();
+ testgetmsg_mvchan();
+ testgetmsg_sp_update();
+ testgetmsg_mattach_err();
+ testgetmsg_mjoin_err();
+ testgetmsg_fp_encr_err();
+ testgetmsg_aflow();
+ testgetmsg_licensepk_sctlv1();
+ testgetmsg_ldone();
+ testgetmsg_lneedlicense();
+ testgetmsg_lhavechal();
+ testgetmsg_sp_deactivate();
+ testgetmsg_sp_einfo();
+ testgetmsg_sp_orders();
+ testgetmsg_sp_bitmap();
+ testgetmsg_sp_cmap();
+ testgetmsg_sp_warp();
+ testgetmsg_fp_orders();
+ testgetmsg_fp_bitmap();
+ testgetmsg_fp_cmap();
+ testgetmsg_fp_warp();
+ testgetcaps_general_bitmap();
return 0;
}
--- a/rle_test.c
+++ b/rle_test.c
@@ -3,7 +3,7 @@
int rletests(void);
static int
-testmemfill1(void)
+testmemfill_repeat(void)
{/* Fill with a pattern shorter than the destination (pattern repeats) */
uchar dst[6];
@@ -14,12 +14,12 @@
memfill(dst, sizeof dst, pat, sizeof pat);
for(i = 0; i < (int)sizeof dst; i++)
if(dst[i] != want[i])
- sysfatal("testmemfill1: dst[%d]: want 0x%x, got 0x%x", i, want[i], dst[i]);+ sysfatal("testmemfill_repeat: dst[%d]: want 0x%x, got 0x%x", i, want[i], dst[i]);return 0;
}
static int
-testmemfill2(void)
+testmemfill_exact(void)
{/* Fill with a pattern equal in length to the destination */
uchar dst[4];
@@ -29,12 +29,12 @@
memfill(dst, sizeof dst, pat, sizeof pat);
for(i = 0; i < (int)sizeof dst; i++)
if(dst[i] != pat[i])
- sysfatal("testmemfill2: dst[%d]: want 0x%x, got 0x%x", i, pat[i], dst[i]);+ sysfatal("testmemfill_exact: dst[%d]: want 0x%x, got 0x%x", i, pat[i], dst[i]);return 0;
}
static int
-testmemfill3(void)
+testmemfill_onebyte(void)
{/* Fill a single byte with a single-byte pattern */
uchar dst[1] = {0x00};@@ -42,12 +42,12 @@
memfill(dst, sizeof dst, pat, sizeof pat);
if(dst[0] != 0x42)
- sysfatal("testmemfill3: dst[0]: want 0x42, got 0x%x", dst[0]);+ sysfatal("testmemfill_onebyte: dst[0]: want 0x42, got 0x%x", dst[0]);return 0;
}
static int
-testmemfill4(void)
+testmemfill_empty(void)
{/* Zero-length destination: no bytes written, returns a1 */
uchar dst[1] = {0x99};@@ -56,14 +56,14 @@
ret = memfill(dst, 0, pat, sizeof pat);
if(ret != dst)
- sysfatal("testmemfill4: return value: want dst, got something else");+ sysfatal("testmemfill_empty: return value: want dst, got something else");if(dst[0] != 0x99)
- sysfatal("testmemfill4: dst[0]: want 0x99, got 0x%x", dst[0]);+ sysfatal("testmemfill_empty: dst[0]: want 0x99, got 0x%x", dst[0]);return 0;
}
static int
-testmemxor1(void)
+testmemxor_basic(void)
{/* Basic XOR of two equal-length arrays */
uchar a[] = {0xFF, 0x0F, 0xAA};@@ -74,12 +74,12 @@
memxor(a, b, sizeof a);
for(i = 0; i < (int)sizeof a; i++)
if((uchar)a[i] != want[i])
- sysfatal("testmemxor1: a[%d]: want 0x%x, got 0x%x", i, want[i], (uchar)a[i]);+ sysfatal("testmemxor_basic: a[%d]: want 0x%x, got 0x%x", i, want[i], (uchar)a[i]);return 0;
}
static int
-testmemxor2(void)
+testmemxor_empty(void)
{/* XOR with zero-length: no bytes modified */
uchar a[] = {0xAB, 0xCD};@@ -87,12 +87,12 @@
memxor(a, b, 0);
if(a[0] != 0xAB || a[1] != 0xCD)
- sysfatal("testmemxor2: unexpected modification: got 0x%x 0x%x", a[0], a[1]);+ sysfatal("testmemxor_empty: unexpected modification: got 0x%x 0x%x", a[0], a[1]);return 0;
}
static int
-testmemxor3(void)
+testmemxor_self(void)
{/* XOR with self yields all zeros */
uchar a[] = {0x12, 0x34, 0x56};@@ -101,12 +101,12 @@
memxor(a, a, sizeof a);
for(i = 0; i < (int)sizeof a; i++)
if(a[i] != 0)
- sysfatal("testmemxor3: a[%d]: want 0, got 0x%x", i, a[i]);+ sysfatal("testmemxor_self: a[%d]: want 0, got 0x%x", i, a[i]);return 0;
}
static int
-testmemxor4(void)
+testmemxor_zeros(void)
{/* XOR with all-zero array leaves original unchanged */
uchar a[] = {0xDE, 0xAD, 0xBE, 0xEF};@@ -117,12 +117,12 @@
memxor(a, z, sizeof a);
for(i = 0; i < (int)sizeof a; i++)
if(a[i] != orig[i])
- sysfatal("testmemxor4: a[%d]: want 0x%x, got 0x%x", i, orig[i], a[i]);+ sysfatal("testmemxor_zeros: a[%d]: want 0x%x, got 0x%x", i, orig[i], a[i]);return 0;
}
static int
-testunrle1(void)
+testunrle_bpix(void)
{/* Bpix extended opcode (0xFE): sets the current pixel to zero */
uchar src[] = {0xFE};@@ -131,16 +131,16 @@
end = unrle(dst, sizeof dst, src, sizeof src, 2, 1);
if(end == nil)
- sysfatal("testunrle1: unexpected error: %r");+ sysfatal("testunrle_bpix: unexpected error: %r");if(end - dst != 1)
- sysfatal("testunrle1: length: want 1, got %d", (int)(end - dst));+ sysfatal("testunrle_bpix: length: want 1, got %d", (int)(end - dst));if(dst[0] != 0)
- sysfatal("testunrle1: pixel: want 0, got %d", dst[0]);+ sysfatal("testunrle_bpix: pixel: want 0, got %d", dst[0]);return 0;
}
static int
-testunrle2(void)
+testunrle_bg_firstline(void)
{/*
* Bg opcode on the first scan line (no previous line):
@@ -153,16 +153,16 @@
end = unrle(dst, sizeof dst, src, sizeof src, 4, 1);
if(end == nil)
- sysfatal("testunrle2: unexpected error: %r");+ sysfatal("testunrle_bg_firstline: unexpected error: %r");if(end - dst != 1)
- sysfatal("testunrle2: length: want 1, got %d", (int)(end - dst));+ sysfatal("testunrle_bg_firstline: length: want 1, got %d", (int)(end - dst));if(dst[0] != 0)
- sysfatal("testunrle2: pixel: want 0, got %d", dst[0]);+ sysfatal("testunrle_bg_firstline: pixel: want 0, got %d", dst[0]);return 0;
}
static int
-testunrle3(void)
+testunrle_mix_zeromask(void)
{/*
* Mix opcode on the first scan line with an all-zero mask byte:
@@ -178,17 +178,17 @@
memset(dst, 0xFF, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle3: unexpected error: %r");+ sysfatal("testunrle_mix_zeromask: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle3: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_mix_zeromask: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 8; i++)
if(dst[i] != 0)
- sysfatal("testunrle3: dst[%d]: want 0, got %d", i, dst[i]);+ sysfatal("testunrle_mix_zeromask: dst[%d]: want 0, got %d", i, dst[i]);return 0;
}
static int
-testunrle4(void)
+testunrle_lit(void)
{/*
* Lit opcode: code=8, bits=Bits5=31, raw_len=3 → len=3 pixels.
@@ -200,17 +200,17 @@
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle4: unexpected error: %r");+ sysfatal("testunrle_lit: unexpected error: %r");if(end - dst != 3)
- sysfatal("testunrle4: length: want 3, got %d", (int)(end - dst));+ sysfatal("testunrle_lit: length: want 3, got %d", (int)(end - dst));if(dst[0] != 0xAA || dst[1] != 0xBB || dst[2] != 0xCC)
- sysfatal("testunrle4: pixels: want AA BB CC, got %02x %02x %02x",+ sysfatal("testunrle_lit: pixels: want AA BB CC, got %02x %02x %02x",dst[0], dst[1], dst[2]);
return 0;
}
static int
-testunrle5(void)
+testunrle_fg_firstline(void)
{/*
* Fg opcode on the first scan line (no previous line):
@@ -225,17 +225,17 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle5: unexpected error: %r");+ sysfatal("testunrle_fg_firstline: unexpected error: %r");if(end - dst != 4)
- sysfatal("testunrle5: length: want 4, got %d", (int)(end - dst));+ sysfatal("testunrle_fg_firstline: length: want 4, got %d", (int)(end - dst));for(i = 0; i < 4; i++)
if(dst[i] != 0xFF)
- sysfatal("testunrle5: dst[%d]: want 0xFF, got 0x%02x", i, dst[i]);+ sysfatal("testunrle_fg_firstline: dst[%d]: want 0xFF, got 0x%02x", i, dst[i]);return 0;
}
static int
-testunrle6(void)
+testunrle_fgs(void)
{/*
* FgS opcode: code=12, bits=Bits4=15, raw_len=1 → len=1 pixel.
@@ -248,16 +248,16 @@
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle6: unexpected error: %r");+ sysfatal("testunrle_fgs: unexpected error: %r");if(end - dst != 1)
- sysfatal("testunrle6: length: want 1, got %d", (int)(end - dst));+ sysfatal("testunrle_fgs: length: want 1, got %d", (int)(end - dst));if(dst[0] != 0x42)
- sysfatal("testunrle6: pixel: want 0x42, got 0x%02x", dst[0]);+ sysfatal("testunrle_fgs: pixel: want 0x42, got 0x%02x", dst[0]);return 0;
}
static int
-testunrle7(void)
+testunrle_fill(void)
{/*
* Fill opcode: code=6, bits=Bits5=31, raw_len=3 → len=3 pixels.
@@ -271,17 +271,17 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle7: unexpected error: %r");+ sysfatal("testunrle_fill: unexpected error: %r");if(end - dst != 3)
- sysfatal("testunrle7: length: want 3, got %d", (int)(end - dst));+ sysfatal("testunrle_fill: length: want 3, got %d", (int)(end - dst));for(i = 0; i < 3; i++)
if(dst[i] != 0x55)
- sysfatal("testunrle7: dst[%d]: want 0x55, got 0x%02x", i, dst[i]);+ sysfatal("testunrle_fill: dst[%d]: want 0x55, got 0x%02x", i, dst[i]);return 0;
}
static int
-testunrle8(void)
+testunrle_dith(void)
{/*
* Dith opcode: code=14, bits=Bits4=15, raw_len=1 → len=1 (×pixelsize).
@@ -295,16 +295,16 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle8: unexpected error: %r");+ sysfatal("testunrle_dith: unexpected error: %r");if(end - dst != 2)
- sysfatal("testunrle8: length: want 2, got %d", (int)(end - dst));+ sysfatal("testunrle_dith: length: want 2, got %d", (int)(end - dst));if(dst[0] != 0xAA || dst[1] != 0xBB)
- sysfatal("testunrle8: pixels: want AA BB, got %02x %02x", dst[0], dst[1]);+ sysfatal("testunrle_dith: pixels: want AA BB, got %02x %02x", dst[0], dst[1]);return 0;
}
static int
-testunrle9(void)
+testunrle_wpix(void)
{/*
* Wpix extended opcode (0xFD): sets the current pixel to DWhite (0xFF).
@@ -316,16 +316,16 @@
dst[0] = 0;
end = unrle(dst, sizeof dst, src, sizeof src, 2, 1);
if(end == nil)
- sysfatal("testunrle9: unexpected error: %r");+ sysfatal("testunrle_wpix: unexpected error: %r");if(end - dst != 1)
- sysfatal("testunrle9: length: want 1, got %d", (int)(end - dst));+ sysfatal("testunrle_wpix: length: want 1, got %d", (int)(end - dst));if(dst[0] != 0xFF)
- sysfatal("testunrle9: pixel: want 0xFF, got 0x%02x", dst[0]);+ sysfatal("testunrle_wpix: pixel: want 0xFF, got 0x%02x", dst[0]);return 0;
}
static int
-testunrle10(void)
+testunrle_mix_nontrivial(void)
{/*
* Mix opcode with non-trivial mask (0xAA = 10101010):
@@ -342,18 +342,18 @@
memset(dst, 0x55, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle10: unexpected error: %r");+ sysfatal("testunrle_mix_nontrivial: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle10: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_mix_nontrivial: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 8; i++)
if(dst[i] != want[i])
- sysfatal("testunrle10: dst[%d]: want 0x%02x, got 0x%02x",+ sysfatal("testunrle_mix_nontrivial: dst[%d]: want 0x%02x, got 0x%02x",i, want[i], dst[i]);
return 0;
}
static int
-testunrle11(void)
+testunrle_mixs(void)
{/*
* MixS opcode: code=13, bits=Bits4=15, raw_len=1 → len=8 pixels.
@@ -368,17 +368,17 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle11: unexpected error: %r");+ sysfatal("testunrle_mixs: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle11: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_mixs: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 8; i++)
if(dst[i] != 0x42)
- sysfatal("testunrle11: dst[%d]: want 0x42, got 0x%02x", i, dst[i]);+ sysfatal("testunrle_mixs: dst[%d]: want 0x42, got 0x%02x", i, dst[i]);return 0;
}
static int
-testunrle12(void)
+testunrle_mix3(void)
{/*
* Mix3 extended opcode (0xF9): fixed bitmask sreg=3 (00000011).
@@ -394,18 +394,18 @@
memset(dst, 0x55, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle12: unexpected error: %r");+ sysfatal("testunrle_mix3: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle12: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_mix3: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 8; i++)
if(dst[i] != want[i])
- sysfatal("testunrle12: dst[%d]: want 0x%02x, got 0x%02x",+ sysfatal("testunrle_mix3: dst[%d]: want 0x%02x, got 0x%02x",i, want[i], dst[i]);
return 0;
}
static int
-testunrle13(void)
+testunrle_mix5(void)
{/*
* Mix5 extended opcode (0xFA): fixed bitmask sreg=5 (00000101).
@@ -421,18 +421,18 @@
memset(dst, 0x55, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle13: unexpected error: %r");+ sysfatal("testunrle_mix5: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle13: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_mix5: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 8; i++)
if(dst[i] != want[i])
- sysfatal("testunrle13: dst[%d]: want 0x%02x, got 0x%02x",+ sysfatal("testunrle_mix5: dst[%d]: want 0x%02x, got 0x%02x",i, want[i], dst[i]);
return 0;
}
static int
-testunrle14(void)
+testunrle_bg_secondline(void)
{/*
* Bg on second scan line: copies pixels from the previous scan line.
@@ -449,18 +449,18 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 4, 1);
if(end == nil)
- sysfatal("testunrle14: unexpected error: %r");+ sysfatal("testunrle_bg_secondline: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle14: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_bg_secondline: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 4; i++)
if(dst[4+i] != dst[i])
- sysfatal("testunrle14: dst[%d]: want 0x%02x, got 0x%02x",+ sysfatal("testunrle_bg_secondline: dst[%d]: want 0x%02x, got 0x%02x",4+i, dst[i], dst[4+i]);
return 0;
}
static int
-testunrle15(void)
+testunrle_fg_secondline(void)
{/*
* Fg on second scan line: fills with pen (DWhite) then XORs with
@@ -479,18 +479,18 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 4, 1);
if(end == nil)
- sysfatal("testunrle15: unexpected error: %r");+ sysfatal("testunrle_fg_secondline: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle15: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_fg_secondline: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 4; i++)
if(dst[4+i] != want[i])
- sysfatal("testunrle15: dst[%d]: want 0x%02x, got 0x%02x",+ sysfatal("testunrle_fg_secondline: dst[%d]: want 0x%02x, got 0x%02x",4+i, want[i], dst[4+i]);
return 0;
}
static int
-testunrle16(void)
+testunrle_fgs_secondline(void)
{/*
* FgS on second scan line: sets a new pen (0xF0) then XORs with
@@ -509,18 +509,18 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 4, 1);
if(end == nil)
- sysfatal("testunrle16: unexpected error: %r");+ sysfatal("testunrle_fgs_secondline: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle16: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_fgs_secondline: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 4; i++)
if(dst[4+i] != want[i])
- sysfatal("testunrle16: dst[%d]: want 0x%02x, got 0x%02x",+ sysfatal("testunrle_fgs_secondline: dst[%d]: want 0x%02x, got 0x%02x",4+i, want[i], dst[4+i]);
return 0;
}
static int
-testunrle17(void)
+testunrle_bg_consecutive(void)
{/*
* Consecutive Bg runs (wasbg flag): after a Bg run sets wasbg=1, the
@@ -537,19 +537,19 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 4, 1);
if(end == nil)
- sysfatal("testunrle17: unexpected error: %r");+ sysfatal("testunrle_bg_consecutive: unexpected error: %r");if(end - dst != 12)
- sysfatal("testunrle17: length: want 12, got %d", (int)(end - dst));+ sysfatal("testunrle_bg_consecutive: length: want 12, got %d", (int)(end - dst));if(dst[8] != 0xEE)
- sysfatal("testunrle17: dst[8]: want 0xEE, got 0x%02x", dst[8]);+ sysfatal("testunrle_bg_consecutive: dst[8]: want 0xEE, got 0x%02x", dst[8]);if(dst[9] != 0x22 || dst[10] != 0x33 || dst[11] != 0x44)
- sysfatal("testunrle17: dst[9..11]: want 22 33 44, got %02x %02x %02x",+ sysfatal("testunrle_bg_consecutive: dst[9..11]: want 22 33 44, got %02x %02x %02x",dst[9], dst[10], dst[11]);
return 0;
}
static int
-testunrle18(void)
+testunrle_overrun(void)
{/*
* Overrun detection: output buffer is smaller than the decoded data.
@@ -561,12 +561,12 @@
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end != nil)
- sysfatal("testunrle18: expected nil return on overrun, got non-nil");+ sysfatal("testunrle_overrun: expected nil return on overrun, got non-nil");return 0;
}
static int
-testunrle19(void)
+testunrle_extbg(void)
{/*
* Extended Bg opcode (0xF0): len taken from following 2-byte little-
@@ -580,17 +580,17 @@
memset(dst, 0xFF, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle19: unexpected error: %r");+ sysfatal("testunrle_extbg: unexpected error: %r");if(end - dst != 4)
- sysfatal("testunrle19: length: want 4, got %d", (int)(end - dst));+ sysfatal("testunrle_extbg: length: want 4, got %d", (int)(end - dst));for(i = 0; i < 4; i++)
if(dst[i] != 0)
- sysfatal("testunrle19: dst[%d]: want 0, got 0x%02x", i, dst[i]);+ sysfatal("testunrle_extbg: dst[%d]: want 0, got 0x%02x", i, dst[i]);return 0;
}
static int
-testunrle20(void)
+testunrle_extfg(void)
{/*
* Extended Fg opcode (0xF1): len from 2-byte field.
@@ -605,17 +605,17 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle20: unexpected error: %r");+ sysfatal("testunrle_extfg: unexpected error: %r");if(end - dst != 3)
- sysfatal("testunrle20: length: want 3, got %d", (int)(end - dst));+ sysfatal("testunrle_extfg: length: want 3, got %d", (int)(end - dst));for(i = 0; i < 3; i++)
if(dst[i] != 0xFF)
- sysfatal("testunrle20: dst[%d]: want 0xFF, got 0x%02x", i, dst[i]);+ sysfatal("testunrle_extfg: dst[%d]: want 0xFF, got 0x%02x", i, dst[i]);return 0;
}
static int
-testunrle21(void)
+testunrle_extlit(void)
{/*
* Extended Lit opcode (0xF4): len from 2-byte field.
@@ -628,17 +628,17 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 10, 1);
if(end == nil)
- sysfatal("testunrle21: unexpected error: %r");+ sysfatal("testunrle_extlit: unexpected error: %r");if(end - dst != 3)
- sysfatal("testunrle21: length: want 3, got %d", (int)(end - dst));+ sysfatal("testunrle_extlit: length: want 3, got %d", (int)(end - dst));if(dst[0] != 0xAA || dst[1] != 0xBB || dst[2] != 0xCC)
- sysfatal("testunrle21: pixels: want AA BB CC, got %02x %02x %02x",+ sysfatal("testunrle_extlit: pixels: want AA BB CC, got %02x %02x %02x",dst[0], dst[1], dst[2]);
return 0;
}
static int
-testunrle22(void)
+testunrle_extfill_32bpp(void)
{/*
* Extended Fill opcode (0xF3) with pixelsize=4 (32-bpp):
@@ -654,12 +654,12 @@
memset(dst, 0, sizeof dst);
end = unrle(dst, sizeof dst, src, sizeof src, 8, 4);
if(end == nil)
- sysfatal("testunrle22: unexpected error: %r");+ sysfatal("testunrle_extfill_32bpp: unexpected error: %r");if(end - dst != 8)
- sysfatal("testunrle22: length: want 8, got %d", (int)(end - dst));+ sysfatal("testunrle_extfill_32bpp: length: want 8, got %d", (int)(end - dst));for(i = 0; i < 8; i++)
if(dst[i] != want[i])
- sysfatal("testunrle22: dst[%d]: want 0x%02x, got 0x%02x",+ sysfatal("testunrle_extfill_32bpp: dst[%d]: want 0x%02x, got 0x%02x",i, want[i], dst[i]);
return 0;
}
@@ -667,35 +667,35 @@
int
rletests(void)
{- testmemfill1();
- testmemfill2();
- testmemfill3();
- testmemfill4();
- testmemxor1();
- testmemxor2();
- testmemxor3();
- testmemxor4();
- testunrle1();
- testunrle2();
- testunrle3();
- testunrle4();
- testunrle5();
- testunrle6();
- testunrle7();
- testunrle8();
- testunrle9();
- testunrle10();
- testunrle11();
- testunrle12();
- testunrle13();
- testunrle14();
- testunrle15();
- testunrle16();
- testunrle17();
- testunrle18();
- testunrle19();
- testunrle20();
- testunrle21();
- testunrle22();
+ testmemfill_repeat();
+ testmemfill_exact();
+ testmemfill_onebyte();
+ testmemfill_empty();
+ testmemxor_basic();
+ testmemxor_empty();
+ testmemxor_self();
+ testmemxor_zeros();
+ testunrle_bpix();
+ testunrle_bg_firstline();
+ testunrle_mix_zeromask();
+ testunrle_lit();
+ testunrle_fg_firstline();
+ testunrle_fgs();
+ testunrle_fill();
+ testunrle_dith();
+ testunrle_wpix();
+ testunrle_mix_nontrivial();
+ testunrle_mixs();
+ testunrle_mix3();
+ testunrle_mix5();
+ testunrle_bg_secondline();
+ testunrle_fg_secondline();
+ testunrle_fgs_secondline();
+ testunrle_bg_consecutive();
+ testunrle_overrun();
+ testunrle_extbg();
+ testunrle_extfg();
+ testunrle_extlit();
+ testunrle_extfill_32bpp();
return 0;
}
--- a/utf16_test.c
+++ b/utf16_test.c
@@ -6,7 +6,7 @@
int utf16tests(void);
static int
-testtoutf161(void)
+testtoutf16_ascii(void)
{/* Single ASCII character 'A' → UTF-16LE: 41 00 */
char s[] = "A";
@@ -15,15 +15,15 @@
n = toutf16(buf, sizeof buf, s, 1);
if(n != 2)
- sysfatal("testtoutf161: len: want 2, got %d", n);+ sysfatal("testtoutf16_ascii: len: want 2, got %d", n);if(buf[0] != 0x41 || buf[1] != 0x00)
- sysfatal("testtoutf161: bytes: want 41 00, got %02x %02x",+ sysfatal("testtoutf16_ascii: bytes: want 41 00, got %02x %02x",buf[0], buf[1]);
return 0;
}
static int
-testtoutf162(void)
+testtoutf16_crlf(void)
{/*
* Newline '\n' → CR LF pair in UTF-16LE: 0D 00 0A 00.
@@ -35,15 +35,15 @@
n = toutf16(buf, sizeof buf, s, 1);
if(n != 4)
- sysfatal("testtoutf162: len: want 4, got %d", n);+ sysfatal("testtoutf16_crlf: len: want 4, got %d", n);if(buf[0]!=0x0D || buf[1]!=0x00 || buf[2]!=0x0A || buf[3]!=0x00)
- sysfatal("testtoutf162: bytes: want 0D 00 0A 00, got %02x %02x %02x %02x",+ sysfatal("testtoutf16_crlf: bytes: want 0D 00 0A 00, got %02x %02x %02x %02x",buf[0], buf[1], buf[2], buf[3]);
return 0;
}
static int
-testtoutf163(void)
+testtoutf16_empty(void)
{/* Empty string (ns=0) → 0 bytes written */
uchar buf[2];
@@ -51,12 +51,12 @@
n = toutf16(buf, sizeof buf, "", 0);
if(n != 0)
- sysfatal("testtoutf163: len: want 0, got %d", n);+ sysfatal("testtoutf16_empty: len: want 0, got %d", n);return 0;
}
static int
-testtoutf164(void)
+testtoutf16_buftoosmall(void)
{/* Buffer too small (1 byte) to hold a UTF-16 unit → 0 bytes written */
char s[] = "A";
@@ -65,12 +65,12 @@
n = toutf16(buf, sizeof buf, s, 1);
if(n != 0)
- sysfatal("testtoutf164: len: want 0, got %d", n);+ sysfatal("testtoutf16_buftoosmall: len: want 0, got %d", n);return 0;
}
static int
-testtoutf165(void)
+testtoutf16_bmp(void)
{/*
* Non-ASCII BMP character U+00E9 'é' (UTF-8: C3 A9)
@@ -82,15 +82,15 @@
n = toutf16(buf, sizeof buf, (char*)s, 2);
if(n != 2)
- sysfatal("testtoutf165: len: want 2, got %d", n);+ sysfatal("testtoutf16_bmp: len: want 2, got %d", n);if(buf[0] != 0xE9 || buf[1] != 0x00)
- sysfatal("testtoutf165: bytes: want E9 00, got %02x %02x",+ sysfatal("testtoutf16_bmp: bytes: want E9 00, got %02x %02x",buf[0], buf[1]);
return 0;
}
static int
-testtoutf166(void)
+testtoutf16_surrogate(void)
{/*
* U+1F600 😀 (UTF-8: F0 9F 98 80) is outside the BMP and encodes
@@ -102,15 +102,15 @@
n = toutf16(buf, sizeof buf, (char*)s, 4);
if(n != 4)
- sysfatal("testtoutf166: len: want 4, got %d", n);+ sysfatal("testtoutf16_surrogate: len: want 4, got %d", n);if(buf[0]!=0x3D || buf[1]!=0xD8 || buf[2]!=0x00 || buf[3]!=0xDE)
- sysfatal("testtoutf166: bytes: want 3D D8 00 DE, got %02x %02x %02x %02x",+ sysfatal("testtoutf16_surrogate: bytes: want 3D D8 00 DE, got %02x %02x %02x %02x",buf[0], buf[1], buf[2], buf[3]);
return 0;
}
static int
-testfromutf161(void)
+testfromutf16_ascii(void)
{/* UTF-16LE 41 00 → ASCII 'A' */
uchar ws[] = {0x41, 0x00};@@ -119,14 +119,14 @@
n = fromutf16(buf, sizeof buf, ws, 2);
if(n != 1)
- sysfatal("testfromutf161: len: want 1, got %d", n);+ sysfatal("testfromutf16_ascii: len: want 1, got %d", n);if(buf[0] != 'A')
- sysfatal("testfromutf161: byte: want 'A', got %02x", (uchar)buf[0]);+ sysfatal("testfromutf16_ascii: byte: want 'A', got %02x", (uchar)buf[0]);return 0;
}
static int
-testfromutf162(void)
+testfromutf16_crlf(void)
{/*
* CR LF in UTF-16LE (0D 00 0A 00): fromutf16 discards CR,
@@ -138,14 +138,14 @@
n = fromutf16(buf, sizeof buf, ws, 4);
if(n != 1)
- sysfatal("testfromutf162: len: want 1, got %d", n);+ sysfatal("testfromutf16_crlf: len: want 1, got %d", n);if(buf[0] != '\n')
- sysfatal("testfromutf162: byte: want '\\n', got %02x", (uchar)buf[0]);+ sysfatal("testfromutf16_crlf: byte: want '\\n', got %02x", (uchar)buf[0]);return 0;
}
static int
-testfromutf163(void)
+testfromutf16_empty(void)
{/* Empty input (nw=0) → 0 bytes written */
uchar ws[1];
@@ -154,12 +154,12 @@
n = fromutf16(buf, sizeof buf, ws, 0);
if(n != 0)
- sysfatal("testfromutf163: len: want 0, got %d", n);+ sysfatal("testfromutf16_empty: len: want 0, got %d", n);return 0;
}
static int
-testfromutf164(void)
+testfromutf16_buftoosmall(void)
{/*
* Output buffer too small for all input: 'A' 'B' in UTF-16LE
@@ -171,14 +171,14 @@
n = fromutf16(buf, sizeof buf, ws, 4);
if(n != 1)
- sysfatal("testfromutf164: len: want 1, got %d", n);+ sysfatal("testfromutf16_buftoosmall: len: want 1, got %d", n);if(buf[0] != 'A')
- sysfatal("testfromutf164: byte: want 'A', got %02x", (uchar)buf[0]);+ sysfatal("testfromutf16_buftoosmall: byte: want 'A', got %02x", (uchar)buf[0]);return 0;
}
static int
-testfromutf165(void)
+testfromutf16_bmp(void)
{/*
* Non-ASCII BMP character: UTF-16LE E9 00 → U+00E9 'é' (UTF-8: C3 A9)
@@ -189,15 +189,15 @@
n = fromutf16((char*)buf, sizeof buf, ws, 2);
if(n != 2)
- sysfatal("testfromutf165: len: want 2, got %d", n);+ sysfatal("testfromutf16_bmp: len: want 2, got %d", n);if(buf[0] != 0xC3 || buf[1] != 0xA9)
- sysfatal("testfromutf165: bytes: want C3 A9, got %02x %02x",+ sysfatal("testfromutf16_bmp: bytes: want C3 A9, got %02x %02x",buf[0], buf[1]);
return 0;
}
static int
-testfromutf166(void)
+testfromutf16_surrogate(void)
{/*
* Surrogate pair 3D D8 00 DE → U+1F600 😀 (UTF-8: F0 9F 98 80)
@@ -208,9 +208,9 @@
n = fromutf16((char*)buf, sizeof buf, ws, 4);
if(n != 4)
- sysfatal("testfromutf166: len: want 4, got %d", n);+ sysfatal("testfromutf16_surrogate: len: want 4, got %d", n);if(buf[0]!=0xF0 || buf[1]!=0x9F || buf[2]!=0x98 || buf[3]!=0x80)
- sysfatal("testfromutf166: bytes: want F0 9F 98 80, got %02x %02x %02x %02x",+ sysfatal("testfromutf16_surrogate: bytes: want F0 9F 98 80, got %02x %02x %02x %02x",buf[0], buf[1], buf[2], buf[3]);
return 0;
}
@@ -218,17 +218,17 @@
int
utf16tests(void)
{- testtoutf161();
- testtoutf162();
- testtoutf163();
- testtoutf164();
- testtoutf165();
- testtoutf166();
- testfromutf161();
- testfromutf162();
- testfromutf163();
- testfromutf164();
- testfromutf165();
- testfromutf166();
+ testtoutf16_ascii();
+ testtoutf16_crlf();
+ testtoutf16_empty();
+ testtoutf16_buftoosmall();
+ testtoutf16_bmp();
+ testtoutf16_surrogate();
+ testfromutf16_ascii();
+ testfromutf16_crlf();
+ testfromutf16_empty();
+ testfromutf16_buftoosmall();
+ testfromutf16_bmp();
+ testfromutf16_surrogate();
return 0;
}
--
⑨