Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

trtl.c File Reference

#include <os2.h>
#include <stdio.h>
#include <process.h>
#include "nt.h"
#include "ntrtl.h"

Go to the source code of this file.

Functions

BOOLEAN StringCompare (IN PSTRING String1, IN PSTRING String2, IN BOOLEAN CaseInSensitive, IN LONG ExpectedResult)
BOOLEAN StringEqual (IN PSTRING String1, IN PSTRING String2, IN BOOLEAN CaseInSensitive, IN BOOLEAN ExpectedResult)
VOID DumpString (IN PCH StringTitle, IN PSTRING String)
BOOLEAN TestString (void)
int _CDECL main (int argc, char *argv[])

Variables

char * TestMemoryStrings []


Function Documentation

VOID DumpString IN PCH  StringTitle,
IN PSTRING  String
 

Definition at line 100 of file trtl.c.

References DbgPrint, and String.

Referenced by TestString().

00104 { 00105 DbgPrint( "%s: (%d, %d) \"%.*s\"\n", StringTitle, 00106 String->MaximumLength, 00107 String->Length, 00108 String->Length, 00109 String->Buffer ); 00110 }

int _CDECL main int  argc,
char *  argv[]
 

Definition at line 178 of file trtl.c.

References DbgPrint, exit, and TestString().

00182 { 00183 if (!TestString()) { 00184 DbgPrint( "TRTL: TestString failed\n" ); 00185 exit( 1 ); 00186 } 00187 00188 exit( 0 ); 00189 return( 0 ); 00190 }

BOOLEAN StringCompare IN PSTRING  String1,
IN PSTRING  String2,
IN BOOLEAN  CaseInSensitive,
IN LONG  ExpectedResult
 

Definition at line 44 of file trtl.c.

References DbgPrint, FALSE, L, RtlCompareString(), String1, String2, and TRUE.

Referenced by TestString().

00050 { 00051 LONG Result = RtlCompareString( String1, String2, CaseInSensitive ); 00052 00053 if (Result < 0) { 00054 Result = -1L; 00055 } 00056 else { 00057 if (Result > 0) { 00058 Result = 1L; 00059 } 00060 } 00061 00062 if (Result != ExpectedResult) { 00063 DbgPrint( "RtlCompareString( \"%.*s\", \"%.*s\", %d ) == %ld (%ld)\n", 00064 String1->Length, String1->Buffer, 00065 String2->Length, String2->Buffer, 00066 CaseInSensitive, 00067 Result, ExpectedResult 00068 ); 00069 return( FALSE ); 00070 } 00071 else { 00072 return( TRUE ); 00073 } 00074 }

BOOLEAN StringEqual IN PSTRING  String1,
IN PSTRING  String2,
IN BOOLEAN  CaseInSensitive,
IN BOOLEAN  ExpectedResult
 

Definition at line 77 of file trtl.c.

References DbgPrint, FALSE, RtlEqualString(), String1, String2, and TRUE.

Referenced by TestString().

00083 { 00084 BOOLEAN Result = RtlEqualString( String1, String2, CaseInSensitive ); 00085 00086 if (Result != ExpectedResult) { 00087 DbgPrint( "RtlEqualString( \"%.*s\", \"%.*s\", %d ) == %d (%d)\n", 00088 String1->Length, String1->Buffer, 00089 String2->Length, String2->Buffer, 00090 CaseInSensitive, 00091 Result, ExpectedResult ); 00092 return( FALSE ); 00093 } 00094 else { 00095 return( TRUE ); 00096 } 00097 }

BOOLEAN TestString void   ) 
 

Definition at line 114 of file trtl.c.

References DumpString(), FALSE, L, NULL, RtlCopyString(), RtlInitString(), String1, String2, StringCompare(), StringEqual(), and TRUE.

Referenced by main().

00115 { 00116 BOOLEAN Result; 00117 char buffer5[ 80 ], buffer6[ 15 ], buffer7[ 3 ]; 00118 STRING String1, String2, String3, String4; 00119 STRING String5, String6, String7, String8; 00120 // 1 2 00121 //12345678901234567890 00122 // 00123 RtlInitString( &String1, " One" ); 00124 RtlInitString( &String2, " Two" ); 00125 RtlInitString( &String3, " Three" ); 00126 RtlInitString( &String4, " Four" ); 00127 String5.Buffer = buffer5; 00128 String5.MaximumLength = sizeof( buffer5 ); 00129 String5.Length = 0; 00130 String6.Buffer = buffer6; 00131 String6.MaximumLength = sizeof( buffer6 ); 00132 String6.Length = 0; 00133 String7.Buffer = buffer7; 00134 String7.MaximumLength = sizeof( buffer7 ); 00135 String7.Length = 0; 00136 String8.Buffer = NULL; 00137 String8.MaximumLength = 0; 00138 String8.Length = 0; 00139 RtlCopyString( &String5, &String1 ); 00140 RtlCopyString( &String6, &String2 ); 00141 RtlCopyString( &String7, &String3 ); 00142 RtlCopyString( &String8, &String4 ); 00143 00144 DumpString( "String1", &String1 ); 00145 DumpString( "String2", &String2 ); 00146 DumpString( "String3", &String3 ); 00147 DumpString( "String4", &String4 ); 00148 DumpString( "String5", &String5 ); 00149 DumpString( "String6", &String6 ); 00150 DumpString( "String7", &String7 ); 00151 DumpString( "String8", &String8 ); 00152 00153 Result = TRUE; 00154 Result &= StringCompare( &String1, &String1, FALSE, 0L ); 00155 Result &= StringCompare( &String1, &String2, FALSE, -1L); 00156 Result &= StringCompare( &String1, &String3, FALSE, -1L); 00157 Result &= StringCompare( &String1, &String4, FALSE, 1L ); 00158 Result &= StringCompare( &String1, &String5, FALSE, 0L ); 00159 Result &= StringCompare( &String1, &String6, FALSE, -1L); 00160 Result &= StringCompare( &String1, &String7, FALSE, -1L); 00161 Result &= StringCompare( &String1, &String8, FALSE, 1L ); 00162 00163 Result &= StringEqual( &String1, &String1, FALSE, 1 ); 00164 Result &= StringEqual( &String1, &String2, FALSE, 0 ); 00165 Result &= StringEqual( &String1, &String3, FALSE, 0 ); 00166 Result &= StringEqual( &String1, &String4, FALSE, 0 ); 00167 Result &= StringEqual( &String1, &String5, FALSE, 1 ); 00168 Result &= StringEqual( &String1, &String6, FALSE, 0 ); 00169 Result &= StringEqual( &String1, &String7, FALSE, 0 ); 00170 Result &= StringEqual( &String1, &String8, FALSE, 0 ); 00171 00172 return( Result ); 00173 }


Variable Documentation

char* TestMemoryStrings[]
 

Initial value:

{ "", "1", "12", "123", "1234", "12345", "123456", "1234567", "12345678", "123456789", "123456789A", NULL }

Definition at line 27 of file trtl.c.


Generated on Sat May 15 19:45:49 2004 for test by doxygen 1.3.7