| 1 | // Licensed to the .NET Foundation under one or more agreements. | 
|---|
| 2 | // The .NET Foundation licenses this file to you under the MIT license. | 
|---|
| 3 | // See the LICENSE file in the project root for more information. | 
|---|
| 4 |  | 
|---|
| 5 | /*============================================================ | 
|---|
| 6 | ** | 
|---|
| 7 | ** Source: test.c | 
|---|
| 8 | ** | 
|---|
| 9 | ** Purpose: Test for CharNextA, ensures it returns an LPTSTR | 
|---|
| 10 | ** | 
|---|
| 11 | ** | 
|---|
| 12 | **=========================================================*/ | 
|---|
| 13 |  | 
|---|
| 14 | /* Depends on strcmp() */ | 
|---|
| 15 |  | 
|---|
| 16 | #include <palsuite.h> | 
|---|
| 17 |  | 
|---|
| 18 | void testString(LPSTR input, LPSTR expected) | 
|---|
| 19 | { | 
|---|
| 20 |  | 
|---|
| 21 | LPTSTR pReturned = NULL; | 
|---|
| 22 |  | 
|---|
| 23 | pReturned = CharNextA(input); | 
|---|
| 24 |  | 
|---|
| 25 | /* Compare the Returned String to what it should be */ | 
|---|
| 26 | if(strcmp(expected,pReturned) != 0) | 
|---|
| 27 | { | 
|---|
| 28 | Fail( "ERROR: CharNextA Failed: [%s] and [%s] are not equal, " | 
|---|
| 29 | "they should be after calling CharNextA.\n", | 
|---|
| 30 | pReturned,expected); | 
|---|
| 31 | } | 
|---|
| 32 |  | 
|---|
| 33 |  | 
|---|
| 34 | } | 
|---|
| 35 |  | 
|---|
| 36 | int __cdecl main(int argc, char *argv[]) | 
|---|
| 37 | { | 
|---|
| 38 |  | 
|---|
| 39 | /* | 
|---|
| 40 | * Initialize the PAL and return FAILURE if this fails | 
|---|
| 41 | */ | 
|---|
| 42 |  | 
|---|
| 43 | if(0 != (PAL_Initialize(argc, argv))) | 
|---|
| 44 | { | 
|---|
| 45 | return FAIL; | 
|---|
| 46 | } | 
|---|
| 47 |  | 
|---|
| 48 | /* test several Strings */ | 
|---|
| 49 | testString( "this is the string", "his is the string"); | 
|---|
| 50 | testString( "t", ""); | 
|---|
| 51 | testString( "", ""); | 
|---|
| 52 | testString( "a\t", "\t"); | 
|---|
| 53 | testString( "a\a", "\a"); | 
|---|
| 54 | testString( "a\b", "\b"); | 
|---|
| 55 | testString( "a\"", "\""); | 
|---|
| 56 | testString( "a\\", "\\"); | 
|---|
| 57 | testString( "\\", ""); | 
|---|
| 58 | testString( "\f", ""); | 
|---|
| 59 | testString( "\b", ""); | 
|---|
| 60 |  | 
|---|
| 61 | PAL_Terminate(); | 
|---|
| 62 | return PASS; | 
|---|
| 63 | } | 
|---|
| 64 |  | 
|---|
| 65 |  | 
|---|
| 66 |  | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|