| 49 | } |
| 50 | |
| 51 | int compareProperties(const std::vector<cl_properties>& queried, |
| 52 | const std::vector<cl_properties>& check) |
| 53 | { |
| 54 | if (queried.size() != 0) |
| 55 | { |
| 56 | if (queried.back() != 0) |
| 57 | { |
| 58 | log_error("ERROR: queried properties do not end with 0!\n"); |
| 59 | return TEST_FAIL; |
| 60 | } |
| 61 | if (queried.size() % 2 != 1) |
| 62 | { |
| 63 | log_error("ERROR: queried properties does not consist of " |
| 64 | "property-value pairs!\n"); |
| 65 | return TEST_FAIL; |
| 66 | } |
| 67 | } |
| 68 | if (check.size() != 0) |
| 69 | { |
| 70 | if (check.back() != 0) |
| 71 | { |
| 72 | log_error("ERROR: check properties do not end with 0!\n"); |
| 73 | return TEST_FAIL; |
| 74 | } |
| 75 | if (check.size() % 2 != 1) |
| 76 | { |
| 77 | log_error("ERROR: check properties does not consist of " |
| 78 | "property-value pairs!\n"); |
| 79 | return TEST_FAIL; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | if (queried != check) |
| 84 | { |
| 85 | for (cl_uint i = 0; i < check.size(); i = i + 2) |
| 86 | { |
| 87 | cl_properties check_prop = check[i]; |
| 88 | |
| 89 | if (check_prop == 0) |
| 90 | { |
| 91 | break; |
| 92 | } |
| 93 | |
| 94 | cl_properties check_value = check[i + 1]; |
| 95 | cl_properties queried_value = 0; |
| 96 | |
| 97 | bool found = findProperty(queried, check_prop, queried_value); |
| 98 | |
| 99 | if (!found) |
| 100 | { |
| 101 | log_error("ERROR: expected property 0x%" PRIx64 " not found!\n", |
| 102 | check_prop); |
| 103 | return TEST_FAIL; |
| 104 | } |
| 105 | else if (check_value != queried_value) |
| 106 | { |
| 107 | log_error("ERROR: mis-matched value for property 0x%" PRIx64 |
| 108 | ": wanted " |