From 2b1871fd2b02decb4eb2f295f81b231f4c5e5129 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 29 Aug 2019 17:46:50 +0100 Subject: [PATCH] CPP: Remove the old test. I don't think preserving a duplicate test of deprecated queries is helpful. --- .../ConstructorOrMethodWithExactDate.cpp | 40 ------------- ...nstructorOrMethodWithExactEraDate.expected | 3 - .../ConstructorOrMethodWithExactEraDate.qlref | 1 - .../Japanese Era/StructWithExactDate.cpp | 57 ------------------- .../StructWithExactEraDate.expected | 2 - .../Japanese Era/StructWithExactEraDate.qlref | 1 - 6 files changed, 104 deletions(-) delete mode 100644 cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactDate.cpp delete mode 100644 cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactEraDate.expected delete mode 100644 cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactEraDate.qlref delete mode 100644 cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactDate.cpp delete mode 100644 cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactEraDate.expected delete mode 100644 cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactEraDate.qlref diff --git a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactDate.cpp b/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactDate.cpp deleted file mode 100644 index a1eef2e3b90..00000000000 --- a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactDate.cpp +++ /dev/null @@ -1,40 +0,0 @@ -class EraInfo -{ -public: - EraInfo() { - - }; - - EraInfo(int year, int month, int day) { - - }; - - EraInfo(int Era, int foo, int year, int month, int day, const wchar_t * eraName) - { - - } - - static EraInfo * EraInfoFromDate(int Era, int foo, int year, int month, int day, wchar_t * eraName) - { - return new EraInfo(Era, foo, year, month, day, eraName); - } -}; - -int Main() -{ - - // BAD: constructor creating a EraInfo with exact Heisei era start date - EraInfo * pDateTimeUtil = new EraInfo(1989, 1, 8); - - // BAD: constructor creating a EraInfo with exact Heisei era start date - EraInfo * pDateTimeUtil1 = new EraInfo(1, 2, 1989, 1, 8, L"\u5e73\u6210"); - - // Good: constructor creating a EraInfo with another date - EraInfo * pDateTimeUtil2 = new EraInfo(1, 2, 1900, 1, 1, L"foo"); - - // BAD: method call passing exact Haisei era start date as parameters - EraInfo * pDateTimeUtil3 = EraInfo::EraInfoFromDate(1, 2, 1989, 1, 8, L"\u5e73\u6210"); - - // GOOD: method call with the same parameters in a different order (we only track year, month, day) - EraInfo * pDateTimeUtil4 = EraInfo::EraInfoFromDate(1, 2, 8, 1, 1989, L"\u5e73\u6210"); -} \ No newline at end of file diff --git a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactEraDate.expected b/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactEraDate.expected deleted file mode 100644 index 9b6c731ebd4..00000000000 --- a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactEraDate.expected +++ /dev/null @@ -1,3 +0,0 @@ -| ConstructorOrMethodWithExactDate.cpp:27:31:27:53 | call to EraInfo | Call that appears to have hard-coded Japanese era start date as parameter. | -| ConstructorOrMethodWithExactDate.cpp:30:32:30:77 | call to EraInfo | Call that appears to have hard-coded Japanese era start date as parameter. | -| ConstructorOrMethodWithExactDate.cpp:36:32:36:55 | call to EraInfoFromDate | Call that appears to have hard-coded Japanese era start date as parameter. | diff --git a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactEraDate.qlref b/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactEraDate.qlref deleted file mode 100644 index 2e5a8969872..00000000000 --- a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/ConstructorOrMethodWithExactEraDate.qlref +++ /dev/null @@ -1 +0,0 @@ -Likely Bugs/JapaneseEra/ConstructorOrMethodWithExactEraDate.ql diff --git a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactDate.cpp b/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactDate.cpp deleted file mode 100644 index 9c2b9eb0640..00000000000 --- a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactDate.cpp +++ /dev/null @@ -1,57 +0,0 @@ -typedef unsigned short WORD; - -struct tm -{ - int tm_sec; // seconds after the minute - [0, 60] including leap second - int tm_min; // minutes after the hour - [0, 59] - int tm_hour; // hours since midnight - [0, 23] - int tm_mday; // day of the month - [1, 31] - int tm_mon; // months since January - [0, 11] - int tm_year; // years since 1900 - int tm_wday; // days since Sunday - [0, 6] - int tm_yday; // days since January 1 - [0, 365] - int tm_isdst; // daylight savings time flag -}; - -typedef struct _SYSTEMTIME { - WORD wYear; - WORD wMonth; - WORD wDayOfWeek; - WORD wDay; - WORD wHour; - WORD wMinute; - WORD wSecond; - WORD wMilliseconds; -} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME; - -int main() -{ - // BAD: Creation of tm stuct corresponding to the beginning of Heisei era - tm *timeTm = new tm(); - timeTm->tm_year = 1989; - timeTm->tm_mon = 1; - timeTm->tm_mday = 8; - - - // GOOD: Creation of tm stuct with different date - tm *timeTm1 = new tm(); - timeTm1->tm_year = 1988; - timeTm1->tm_mon = 1; - timeTm1->tm_mday = 1; - - // BAD: Creation of SYSTEMTIME stuct corresponding to the beginning of Heisei era - SYSTEMTIME st; - st.wDay = 8; - st.wMonth = 1; - st.wYear = 1989; - - - // GOOD: Creation of SYSTEMTIME stuct with a different date - SYSTEMTIME st1; - st1.wDay = 1; - st1.wMonth = 1; - st1.wYear = 1990; - - return 0; -} - diff --git a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactEraDate.expected b/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactEraDate.expected deleted file mode 100644 index c31c9cc4d7a..00000000000 --- a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactEraDate.expected +++ /dev/null @@ -1,2 +0,0 @@ -| StructWithExactDate.cpp:31:13:31:19 | tm_year | A time struct that is initialized with exact Japanese calendar era start date. | -| StructWithExactDate.cpp:46:8:46:12 | wYear | A time struct that is initialized with exact Japanese calendar era start date. | diff --git a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactEraDate.qlref b/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactEraDate.qlref deleted file mode 100644 index 443b15e6da3..00000000000 --- a/cpp/ql/test/query-tests/Likely Bugs/Japanese Era/StructWithExactEraDate.qlref +++ /dev/null @@ -1 +0,0 @@ -Likely Bugs/JapaneseEra/StructWithExactEraDate.ql