|
| 1 | +//===- status-string.c ----------------------------------------------------===// |
| 2 | +// |
| 3 | +// Part of Comgr, under the Apache License v2.0 with LLVM Exceptions. See |
| 4 | +// amd/comgr/LICENSE.TXT in this repository for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | + |
| 9 | +#include "amd_comgr.h" |
| 10 | +#include "common.h" |
| 11 | +#include <stdio.h> |
| 12 | +#include <stdlib.h> |
| 13 | +#include <string.h> |
| 14 | + |
| 15 | +int main(int argc, char *argv[]) { |
| 16 | + const char *StatusString = malloc(sizeof(char) * 100); |
| 17 | + amd_comgr_(status_string(AMD_COMGR_STATUS_SUCCESS, &StatusString)); |
| 18 | + if (strcmp(StatusString, "SUCCESS")) |
| 19 | + fail("incorrect status: expected 'SUCCESS', saw '%s'", StatusString); |
| 20 | + |
| 21 | + amd_comgr_(status_string(AMD_COMGR_STATUS_ERROR, &StatusString)); |
| 22 | + if (strcmp(StatusString, "ERROR")) |
| 23 | + fail("incorrect status: expected 'ERROR', saw '%s'", StatusString); |
| 24 | + |
| 25 | + amd_comgr_(status_string(AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT, |
| 26 | + &StatusString)); |
| 27 | + if (strcmp(StatusString, "INVALID_ARGUMENT")) { |
| 28 | + fail("incorrect status: expected 'INVALID_ARGUMENT', saw '%s'", |
| 29 | + StatusString); |
| 30 | + } |
| 31 | + |
| 32 | + amd_comgr_(status_string(AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES, |
| 33 | + &StatusString)); |
| 34 | + if (strcmp(StatusString, "OUT_OF_RESOURCES")) { |
| 35 | + fail("incorrect status: expected 'OUT_OF_RESOURCES', saw '%s'", |
| 36 | + StatusString); |
| 37 | + } |
| 38 | + |
| 39 | + fail_amd_comgr_(status_string(-1, &StatusString)); |
| 40 | + free(StatusString); |
| 41 | + return 0; |
| 42 | +} |
0 commit comments