1#include <gtest/gtest.h>
2
3#include <base/detect.h>
4
5#include <engine/client/blocklist_driver.h>
6
7TEST(BlocklistDriver, Valid1)
8{
9#ifdef CONF_FAMILY_WINDOWS
10 int Major = -1, Minor = -1, Patch = -1;
11 bool WarningReq = false;
12 EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7810", Major, Minor, Patch, WarningReq), "This Intel driver version can cause crashes, please update it to a newer version.");
13 EXPECT_EQ(Major, 2);
14 EXPECT_EQ(Minor, 0);
15 EXPECT_EQ(Patch, 0);
16#endif
17}
18
19TEST(BlocklistDriver, Valid2)
20{
21#ifdef CONF_FAMILY_WINDOWS
22 int Major = -1, Minor = -1, Patch = -1;
23 bool WarningReq = false;
24 EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7926", Major, Minor, Patch, WarningReq), "This Intel driver version can cause crashes, please update it to a newer version.");
25 EXPECT_EQ(Major, 2);
26 EXPECT_EQ(Minor, 0);
27 EXPECT_EQ(Patch, 0);
28#endif
29}
30
31TEST(BlocklistDriver, Valid3)
32{
33#ifdef CONF_FAMILY_WINDOWS
34 int Major = -1, Minor = -1, Patch = -1;
35 bool WarningReq = false;
36 EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7985", Major, Minor, Patch, WarningReq), "This Intel driver version can cause crashes, please update it to a newer version.");
37 EXPECT_EQ(Major, 2);
38 EXPECT_EQ(Minor, 0);
39 EXPECT_EQ(Patch, 0);
40#endif
41}
42
43TEST(BlocklistDriver, Invalid)
44{
45 int Major, Minor, Patch;
46 bool WarningReq = false;
47#ifdef CONF_FAMILY_WINDOWS
48 EXPECT_STREQ(ParseBlocklistDriverVersions("AMD", "Build 25.20.100.7810", Major, Minor, Patch, WarningReq), NULL);
49 EXPECT_STREQ(ParseBlocklistDriverVersions("NVIDIA", "Build 26.20.100.7799", Major, Minor, Patch, WarningReq), NULL);
50#else
51 EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7985", Major, Minor, Patch, WarningReq), NULL);
52 EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7799", Major, Minor, Patch, WarningReq), NULL);
53#endif
54}
55