/******************************************************************** * COPYRIGHT: * Copyright (c) 1998-2001, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* * File memstrts.c (Tests the API in umemstrm) * * Modification History: * * Date Name Description * 07/19/2000 Madhu Creation ******************************************************************************* */ #include #include "unicode/utypes.h" #include "cmemory.h" #include "cintltst.h" #include "umemstrm.h" static void TestMemoryStreamAPI(void); static void printUSeqErr(const uint8_t *a, int len); void addMemoryStreamTest(TestNode** root); static void printUSeqErr(const uint8_t *a, int len) { int i=0; fprintf(stderr, "{U+ "); while (i size\n"); x=uprv_mstrm_write(memStream, buffer, sizeof(buffer)/sizeof(buffer[0]) ); if(x == -1){ log_err("uprv_mstrm_write() failed\n"); } if(x != sizeof(buffer)/sizeof(buffer[0])){ log_err("uprv_mstrm_write() wrote %d characters instead of %d\n", x, sizeof(buffer)/sizeof(buffer[0])); } log_verbose("Testing how different functions behave when error is set to true using setError\n"); uprv_mstrm_setError(memStream); gotBuffer=uprv_mstrm_getBuffer(memStream, &x); if(gotBuffer != NULL || x !=0 ){ log_err("uprv_mstrm_getBuffer() should fail when the error is set to true using uprv_mstrm_setError()"); } uprv_mstrm_close(memStream); }