745 cxJsonArrAddIntegers(ints, (int64_t[]){42}, 1); |
745 cxJsonArrAddIntegers(ints, (int64_t[]){42}, 1); |
746 |
746 |
747 // write it to a buffer |
747 // write it to a buffer |
748 CxBuffer buf; |
748 CxBuffer buf; |
749 cxBufferInit(&buf, NULL, 512, NULL, CX_BUFFER_DEFAULT); |
749 cxBufferInit(&buf, NULL, 512, NULL, CX_BUFFER_DEFAULT); |
750 int result = cxJsonWrite(&buf, obj, (cx_write_func) cxBufferWrite, writer); |
750 int result = cxJsonWrite(&buf, obj, cxBufferWriteFunc, writer); |
751 cxBufferTerminate(&buf); // makes debugging easier |
751 cxBufferTerminate(&buf); // makes debugging easier |
752 CX_TEST_ASSERT(result == 0); |
752 CX_TEST_ASSERT(result == 0); |
753 |
753 |
754 // compare the string |
754 // compare the string |
755 CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), expected)); |
755 CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), expected)); |