[KMTEST:FSRTL]
[reactos.git] / rostests / kmtests / ntos_fsrtl / FsRtlExpression.c
index b59e6bb..9c38b7e 100644 (file)
@@ -167,6 +167,44 @@ static VOID FsRtlIsNameInExpressionTest()
     RtlInitUnicodeString(&Name, L"F0_001.txt");
     ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\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) == 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_.");
+    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) == TRUE, "expected TRUE, got FALSE\n");
+    RtlInitUnicodeString(&Name, L"F0_001");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, 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) == TRUE, "expected TRUE, got FALSE\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) == 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(&Expression, L"*.TTF");
     RtlInitUnicodeString(&Name, L".");
     ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
@@ -321,6 +359,10 @@ static VOID FsRtlIsNameInExpressionTest()
     ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
     RtlInitUnicodeString(&Name, L"ac.exe");
     ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
+
+    RtlInitUnicodeString(&Expression, L"<.exe");
+    RtlInitUnicodeString(&Name, L"test.exe");
+    ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
 }
 
 static VOID FsRtlIsDbcsInExpressionTest()
@@ -452,6 +494,32 @@ static VOID FsRtlIsDbcsInExpressionTest()
     RtlInitAnsiString(&Name, "F0_001.txt");
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\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) == TRUE, "expected TRUE, got FALSE\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) == TRUE, "expected TRUE, got FALSE\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) == TRUE, "expected TRUE, got FALSE\n");
+
     RtlInitAnsiString(&Expression, "*.TTF");
     RtlInitAnsiString(&Name, ".");
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
@@ -475,8 +543,12 @@ static VOID FsRtlIsDbcsInExpressionTest()
     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");
+
+    if (!KmtIsCheckedBuild)
+    {
+        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");
@@ -606,6 +678,10 @@ static VOID FsRtlIsDbcsInExpressionTest()
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
     RtlInitAnsiString(&Name, "ac.exe");
     ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
+
+    RtlInitAnsiString(&Expression, "<.exe");
+    RtlInitAnsiString(&Name, "test.exe");
+    ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
 }
 
 START_TEST(FsRtlExpression)