1 /* 2 * PROJECT: ReactOS kernel-mode tests 3 * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+) 4 * PURPOSE: Kernel-Mode Test Suite Example kernel-mode test part 5 * COPYRIGHT: Copyright 2011-2018 Thomas Faber <thomas.faber@reactos.org> 6 */ 7 8 #include <kmt_test.h> 9 10 START_TEST(Example) 11 { 12 KIRQL Irql; 13 14 ok(1, "This test should succeed.\n"); 15 ok(0, "This test should fail.\n"); 16 trace("Message from kernel, low-irql. %s. %ls.\n", "Format strings work", L"Even with Unicode"); 17 KeRaiseIrql(HIGH_LEVEL, &Irql); 18 trace("Message from kernel, high-irql. %s. %ls.\n", "Format strings work", L"Even with Unicode"); 19 20 ok_irql(DISPATCH_LEVEL); 21 ok_eq_int(5, 6); 22 ok_eq_uint(6U, 7U); 23 ok_eq_long(1L, 2L); 24 ok_eq_ulong(3LU, 4LU); 25 ok_eq_pointer((PVOID)8, (PVOID)9); 26 ok_eq_hex(0x1234LU, 0x5678LU); 27 ok_eq_bool(TRUE, TRUE); 28 ok_eq_bool(TRUE, FALSE); 29 ok_eq_bool(FALSE, TRUE); 30 ok_bool_true(FALSE, "foo"); 31 ok_bool_false(TRUE, "bar"); 32 ok_eq_print(1, 2, "%i"); 33 ok_eq_str("Hello", "world"); 34 ok_eq_wstr(L"ABC", L"DEF"); 35 36 if (!skip(KeGetCurrentIrql() == HIGH_LEVEL, "This should only work on HIGH_LEVEL\n")) 37 { 38 /* do tests depending on HIGH_LEVEL here */ 39 ok(1, "This is fine\n"); 40 } 41 42 KeLowerIrql(Irql); 43 } 44