1
2 //
3 // Copyright (c) 2020 The Khronos Group Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16
17 #include <regex>
18 #include "harness/testHarness.h"
19 #include "harness/deviceInfo.h"
20
test_conformance_version(cl_device_id deviceID,cl_context context,cl_command_queue ignoreQueue,int num_elements)21 int test_conformance_version(cl_device_id deviceID, cl_context context,
22 cl_command_queue ignoreQueue, int num_elements)
23 {
24 std::string version_string{ get_device_info_string(
25 deviceID, CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED) };
26
27 // Latest conformance version passed should match vYYYY-MM-DD-XX, where XX
28 // is a number
29 std::regex valid_format("^v\\d{4}-(((0)[1-9])|((1)[0-2]))-((0)[1-9]|[1-2]["
30 "0-9]|(3)[0-1])-\\d{2}$");
31 test_assert_error(
32 std::regex_match(version_string, valid_format),
33 "CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED does not return "
34 "valid format vYYYY-MM-DD-XX");
35
36 return TEST_PASS;
37 }
38