83 lines
1.7 KiB
C
83 lines
1.7 KiB
C
/*
|
|
* nwtests.c - developer-only tests
|
|
*
|
|
* Run by copying net.exe to tests.exe:
|
|
* cp build/dosutils/net.exe SYS/public/tests.exe
|
|
*
|
|
* Then in DOS:
|
|
* TESTS
|
|
* TESTS NETCALL
|
|
*/
|
|
|
|
#include "net.h"
|
|
|
|
static void tests_usage(void)
|
|
{
|
|
fprintf(stdout, "Usage: TESTS [NETCALL]\n");
|
|
}
|
|
|
|
static int same_arg(char *a, char *b)
|
|
{
|
|
while (*a || *b) {
|
|
int ca = *a++;
|
|
int cb = *b++;
|
|
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
|
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
|
if (ca != cb) return(0);
|
|
}
|
|
return(1);
|
|
}
|
|
|
|
static int test_netcall(void)
|
|
{
|
|
unsigned char req[4];
|
|
unsigned char repl[4];
|
|
int asm_rc;
|
|
int c_rc;
|
|
|
|
memset(req, 0, sizeof(req));
|
|
memset(repl, 0, sizeof(repl));
|
|
|
|
fprintf(stdout, "TEST Net_Call ASM vs C\n");
|
|
fprintf(stdout, "Call: INT 21h AH=19h get current drive\n");
|
|
fprintf(stdout, "Expected: AL=0 for A:, 1 for B:, 2 for C:, ...\n\n");
|
|
|
|
/*
|
|
* Safe DOS call. It ignores DS:SI and ES:DI, so it is ideal for testing
|
|
* register setup without touching NetWare/NCP.
|
|
*/
|
|
asm_rc = Net_Call(0x1900, req, repl);
|
|
fprintf(stdout, "ASM Net_Call(1900h) rc=%04X drive=%c:\n",
|
|
asm_rc, 'A' + (asm_rc & 0xff));
|
|
|
|
c_rc = Net_Call_C(0x1900, req, repl);
|
|
fprintf(stdout, "C Net_Call_C(1900h) rc=%04X drive=%c:\n",
|
|
c_rc, 'A' + (c_rc & 0xff));
|
|
|
|
Net_Call_C_Dump();
|
|
|
|
if ((asm_rc & 0xff) == (c_rc & 0xff))
|
|
fprintf(stdout, "\nNETCALL C basic register test OK\n");
|
|
else
|
|
fprintf(stdout, "\nNETCALL C basic register test FAILED\n");
|
|
|
|
return(0);
|
|
}
|
|
|
|
int func_tests(int argc, char *argv[], int mode)
|
|
{
|
|
(void)mode;
|
|
|
|
if (argc < 2) {
|
|
tests_usage();
|
|
return(0);
|
|
}
|
|
|
|
if (same_arg(argv[1], "NETCALL")) {
|
|
return(test_netcall());
|
|
}
|
|
|
|
tests_usage();
|
|
return(1);
|
|
}
|