[KMTEST:FSRTL]
authorPierre Schweitzer <pierre@reactos.org>
Sat, 20 Apr 2013 12:24:57 +0000 (12:24 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 20 Apr 2013 12:24:57 +0000 (12:24 +0000)
Add more tests for FsRtlIsNameInExpression() by Victor Martinez
Also add these tests for FsRtlIsDbcsInExpression()
See CORE-5125 for more information

svn path=/trunk/; revision=58788

rostests/kmtests/ntos_fsrtl/FsRtlExpression.c

index 766149c..b59e6bb 100644 (file)
@@ -96,8 +96,76 @@ static VOID FsRtlIsNameInExpressionTest()
     ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
     RtlInitUnicodeString(&Name, L"SETUP.EXE");
     ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"F0_");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_.");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_.");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"F0_.");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"F0_001");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"F0_001");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_001");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_001");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"F0_001.");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"f0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"F0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"F0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"F0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+
+    RtlInitUnicodeString(&Expression, L"F0_*.");
+    RtlInitUnicodeString(&Name, L".");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"..");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"SETUP.EXE");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"F0_");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_.");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_.");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"F0_.");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"F0_001");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
     RtlInitUnicodeString(&Name, L"F0_001");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_001");
     ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_001");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"F0_OO1.");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"f0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"f0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"F0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"F0_001.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
 
     RtlInitUnicodeString(&Expression, L"*.TTF");
     RtlInitUnicodeString(&Name, L".");
@@ -115,6 +183,24 @@ static VOID FsRtlIsNameInExpressionTest()
     RtlInitUnicodeString(&Name, L"SETUP.INI");
     ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
 
+    RtlInitUnicodeString(&Expression, L".*");
+    RtlInitUnicodeString(&Name, L"1");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"01");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L" ");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L"");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitUnicodeString(&Name, L".");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n"); 
+    RtlInitUnicodeString(&Name, L"1.txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n"); 
+    RtlInitUnicodeString(&Name, L" .txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n"); 
+    RtlInitUnicodeString(&Name, L".txt");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n"); 
+
     RtlInitUnicodeString(&Expression, L"\"ntoskrnl.exe");
     RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
     ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
@@ -320,8 +406,51 @@ static VOID FsRtlIsDbcsInExpressionTest()
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
     RtlInitAnsiString(&Name, "SETUP.EXE");
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "f0_");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "F0_");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "f0_.");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "F0_.");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitAnsiString(&Name, "F0_001");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+
+    RtlInitAnsiString(&Name, "f0_001");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "F0_001.");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitAnsiString(&Name, "f0_001.txt");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "F0_001.txt");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitAnsiString(&Expression, "F0_*.");
+    RtlInitAnsiString(&Name, ".");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "..");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "SETUP.EXE");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "f0_");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "F0_");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "f0_.");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "F0_.");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
     RtlInitAnsiString(&Name, "F0_001");
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "f0_001");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "F0_OO1.");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitAnsiString(&Name, "f0_001.txt");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "F0_001.txt");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
 
     RtlInitAnsiString(&Expression, "*.TTF");
     RtlInitAnsiString(&Name, ".");
@@ -339,6 +468,24 @@ static VOID FsRtlIsDbcsInExpressionTest()
     RtlInitAnsiString(&Name, "SETUP.INI");
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
 
+    RtlInitAnsiString(&Expression, ".*");
+    RtlInitAnsiString(&Name, "1");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "01");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, " ");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, "");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+    RtlInitAnsiString(&Name, ".");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n"); 
+    RtlInitAnsiString(&Name, "1.txt");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n"); 
+    RtlInitAnsiString(&Name, " .txt");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n"); 
+    RtlInitAnsiString(&Name, ".txt");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n"); 
+
     RtlInitAnsiString(&Expression, "\"ntoskrnl.exe");
     RtlInitAnsiString(&Name, "ntoskrnl.exe");
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");