#include #include #include #define CAIRO_H int main(int argc, char* argv[]) { cairo_status_t status = atof(argv[1]); const char* returned_status_in_string = NULL; const char* expected_string[] ={"no error has occurred", "out of memory", "cairo_restore() called without matching cairo_save()", "no saved group to pop", "no current point defined", "invalid matrix (not invertible)", "invalid value for an input cairo_status_t", "NULL pointer", "input string not valid UTF-8", "input path data not valid", "error while reading from input stream", "error while writing to output stream", "target surface has been finished", "the surface type is not appropriate for the operation", "the pattern type is not appropriate for the operation", "invalid value for an input cairo_content_t", "invalid value for an input cairo_format_t", "invalid value for an input Visual*", "file not found", "invalid value for a dash setting", "invalid value for a DSC comment (Since 1.2)", "invalid index passed to getter (Since 1.4)", "clip region not representable in desired format (Since 1.4)", "error creating or writing to a temporary file (Since 1.6)", "invalid value for stride (Since 1.6)", "the font type is not appropriate for the operation (Since 1.8)", "the user-font is immutable (Since 1.8)", "error occurred in a user-font callback function (Since 1.8)", "negative number used where it is not allowed (Since 1.8)", "input clusters do not represent the accompanying text and glyph array (Since 1.8)", "invalid value for an input cairo_font_slant_t (Since 1.8)", "invalid value for an input cairo_font_weight_t (Since 1.8)"}; returned_status_in_string = cairo_status_to_string( status ); if( strcmp( returned_status_in_string, expected_string[status] ) != 0 ) { printf("The expected string representation of the status(%d) is \"%s\", \nbut this function returns \"%s\".\n", status, expected_string[status], returned_status_in_string); } else { printf("The string representation of the status(%d) is \"%s\" (correct to the spec).\n", status, returned_status_in_string); } return 0; }