예제 #1
0
TEST(xformatc, DoubleFormat3) {
  char output[80];
  TEST_ASSERT_EQUAL(57, testFormat(output,
                                   "+ format: int: %+d, %+d, double: %+.1f, %+.1f, reset: %d, %.1f\n", 3, -3, 3.0, -3.0,
                                   3, 3.0));
  TEST_ASSERT_EQUAL_STRING("+ format: int: +3, -3, double: +3.0, -3.0, reset: 3, 3.0\n", output);
}
예제 #2
0
TEST(xformatc, Long) {
  char output[100];
  TEST_ASSERT_EQUAL(53, testFormat(output,
                                   "long long: %lld, %llu, 0x%llX\n", -831326121984LL, 831326121984LLU,
                                   831326121984LLU));
  TEST_ASSERT_EQUAL_STRING("long long: -831326121984, 831326121984, 0xC18EE5F000\n", output);
}
예제 #3
0
TEST(xformatc, Nullpointer) {
  char output[50];
  char *ptr = "Hello world!";
  char *np = 0;
  TEST_ASSERT_EQUAL(53, testFormat(output,
                                   "ptr=%s, %s is null pointer, char %c='a'\n", ptr, np, 'a'));
  TEST_ASSERT_EQUAL_STRING("ptr=Hello world!, (null) is null pointer, char a='a'\n", output);
}
예제 #4
0
void
IntlTestDateFormat::testLocale(/*char* par, */const Locale& locale, const UnicodeString& localeName)
{
    DateFormat::EStyle timeStyle, dateStyle;
    
    // For patterns including only time information and a timezone, it may take
    // up to three iterations, since the timezone may shift as the year number
    // is determined.  For other patterns, 2 iterations should suffice.
    fLimit = 3;

    for(timeStyle = (DateFormat::EStyle)0; 
        timeStyle < (DateFormat::EStyle)4; 
        timeStyle = (DateFormat::EStyle) (timeStyle+1))
    {
        fTestName = (UnicodeString) "Time test " + (int32_t) timeStyle + " (" + localeName + ")";
        fFormat = DateFormat::createTimeInstance(timeStyle, locale);
        testFormat(/* par */);
    }

    fLimit = 2;

    for(dateStyle = (DateFormat::EStyle)0; 
        dateStyle < (DateFormat::EStyle)4; 
        dateStyle = (DateFormat::EStyle) (dateStyle+1))
    {
        fTestName = (UnicodeString) "Date test " + (int32_t) dateStyle + " (" + localeName + ")";
        fFormat = DateFormat::createDateInstance(dateStyle, locale);
        testFormat(/* par */);
    }

    for(dateStyle = (DateFormat::EStyle)0; 
        dateStyle < (DateFormat::EStyle)4; 
        dateStyle = (DateFormat::EStyle) (dateStyle+1))
    {
        for(timeStyle = (DateFormat::EStyle)0; 
            timeStyle < (DateFormat::EStyle)4; 
            timeStyle = (DateFormat::EStyle) (timeStyle+1))
        {
            fTestName = (UnicodeString) "DateTime test " + (int32_t) dateStyle + "/" + (int32_t) timeStyle + " (" + localeName + ")";
            fFormat = DateFormat::createDateTimeInstance(dateStyle, timeStyle, locale);
            testFormat(/* par */);
        }
    }
}
예제 #5
0
void
IntlTestNumberFormat::testLocale(/* char* par, */const Locale& locale, const UnicodeString& localeName)
{
    const char* name;
    
    fLocale = locale;
    name = "Number test";
    logln((UnicodeString)name + " (" + localeName + ")");
    fStatus = U_ZERO_ERROR;
    fFormat = NumberFormat::createInstance(locale, fStatus);
    testFormat(/* par */);

    name = "Currency test";
    logln((UnicodeString)name + " (" + localeName + ")");
    fStatus = U_ZERO_ERROR;
    fFormat = NumberFormat::createCurrencyInstance(locale, fStatus);
    testFormat(/* par */);

    name = "Percent test";
    logln((UnicodeString)name + " (" + localeName + ")");
    fStatus = U_ZERO_ERROR;
    fFormat = NumberFormat::createPercentInstance(locale, fStatus);
    testFormat(/* par */);
}
	void integrateFss(){
		testFormat();
		testIsExistingFile();
		testGetFileInformation();
		testCreateFile1();
		testCreateFile2();
		testCreateFile3();
		testCreateFile4();
		testGetFileInformationCreated();
		testDeleteFile();
		testGetFileInformationDeleted();
		testAssignAndGetSectors();
		testListDirectory();
		testListInexistingDirectory();
	}
예제 #7
0
void mkFluid::setReflectionSize(U32 size)
{
   mReflectionSize = getNextPow2(mClamp(size, 1, getGlobalReflectionSize()));
   if(mReflectionRT && mReflectionRT->getWidth() != mReflectionSize)
   {
      RenderTextureManager->deleteRenderTexture(mReflectionRT);
      mReflectionRT = NULL;
   }
   if(!mReflectionRT && mReflectionSize > 1)
   {
      RenderTextureFormat testFormat(RGBA8, Depth24, None, Stencil0, 0, false, false);
      RenderTextureFormat bestFit;
      RenderTextureManager->getClosestMatch(testFormat, bestFit);
      
      mReflectionRT = RenderTextureManager->createRenderTexture(mReflectionSize, mReflectionSize, bestFit);
   }
}
예제 #8
0
int main(int argc, char** argv) {
   setup();

   testFormat();
   testMount();
   testUnmount();
   testMountAndUnmount();

   wrapTest(testFileCreationAndDeletion);
   wrapTest(testBulkWriteAndRead);
   wrapTest(testSeek);
   wrapTest(testIncrementalWriteAndRead);
   wrapTest(testDirCreationAndDeletion);
   wrapTest(testNestedDirCreationAndDeletion);

   teardown();

   return 0;
}
예제 #9
0
// par is ignored throughout this file
void IntlTestDateFormat::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
    if (exec) logln("TestSuite DateFormat");
    switch (index) {
        case 0: name = "GenericTest";
            if (exec) {
                logln(name);
                fFormat = DateFormat::createInstance();
                fTestName = "createInstance";
                fLimit = 3;
                testFormat(/* par */);
            }
            break;
        case 1: name = "DefaultLocale";
            if (exec) {
                logln(name);
                testLocale(/*par, */Locale::getDefault(), "Default Locale");
            }
            break;

        case 2: name = "TestAvailableLocales";
            if (exec) {
                logln(name);
                testAvailableLocales(/* par */);
            }
            break;

        case 3: name = "MonsterTest";
            if (exec) {
                logln(name);
                monsterTest(/*par*/);
            }
            break;

        default: name = ""; break;
    }
}
예제 #10
0
/**
 * This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
 * NumberFormat.
 */
void IntlTestNumberFormat::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{

    if (exec) logln((UnicodeString)"TestSuite NumberFormat");
    switch (index) {
        case 0: name = "createInstance"; 
            if (exec)
            {
                logln(name);
                fStatus = U_ZERO_ERROR;
                fFormat = NumberFormat::createInstance(fStatus);
                testFormat(/*par*/);
            }
            break;

        case 1: name = "DefaultLocale";
            if (exec) testLocale(/*par, */Locale::getDefault(), name);
            break;

        case 2: name = "testAvailableLocales"; 
            if (exec) {
                logln(name);
                testAvailableLocales(/*par*/);
            }
            break;

        case 3: name = "monsterTest";
            if (exec) {
                logln(name);
                monsterTest(/*par*/);
            }
            break;

        default: name = ""; break;
    }
}
예제 #11
0
TEST(xformatc, StringPadding) {
  char output[100];
  TEST_ASSERT_EQUAL(59, testFormat(output,
                                   "     padding (pos): zero=[%04d], left=[%-4d], right=[%4d]\n", 3, 3, 3));
  TEST_ASSERT_EQUAL_STRING("     padding (pos): zero=[0003], left=[3   ], right=[   3]\n", output);
}
예제 #12
0
TEST(xformatc, FormatSpecifierReset) {
  char output[50];
  TEST_ASSERT_EQUAL(18, testFormat(output, "w4=[%4d], w0=[%d]\n", 3, 3));
  TEST_ASSERT_EQUAL_STRING("w4=[   3], w0=[3]\n", output);
}
예제 #13
0
TEST(xformatc, StringEscape) {
  char output[100];
  TEST_ASSERT_EQUAL(47, testFormat(output,
                                   "justify: left=\"%-10s\", right=\"%10s\"\n", "left", "right"));
  TEST_ASSERT_EQUAL_STRING("justify: left=\"left      \", right=\"     right\"\n", output);
}
예제 #14
0
TEST(xformatc, StringFormats) {
  char output[50];
  TEST_ASSERT_EQUAL(20, testFormat(output,
                                   "%d %s(s) with %%\n", 0, "message"));
  TEST_ASSERT_EQUAL_STRING("0 message(s) with %\n", output);
}
예제 #15
0
TEST(xformatc, IntFormats) {
  char output[50];
  TEST_ASSERT_EQUAL(27, testFormat(output,
                                   "signed %d = %uU = 0x%X\n", -3, -3, -3));
  TEST_ASSERT_EQUAL_STRING(" ", output);
}
예제 #16
0
TEST(xformatc, DoubleFormat) {
  char output[80];
  TEST_ASSERT_EQUAL(17, testFormat(output, "double: %.3f\n", 1234.56789));
  TEST_ASSERT_EQUAL_STRING("double: 1234.568\n", output);
}
예제 #17
0
TEST(xformatc, NoFormatOperations) {
  char output[5];
  TEST_ASSERT_EQUAL(3, testFormat(output, "hey"));
  TEST_ASSERT_EQUAL_STRING("hey", output);
}
예제 #18
0
TEST(xformatc, Escaped) {
  char output[5];
  TEST_ASSERT_EQUAL(2, testFormat(output, "%%f"));
  TEST_ASSERT_EQUAL_STRING("%f", output);
}
예제 #19
0
TEST(xformatc, Simple) {
  char output[20];
  TEST_ASSERT_EQUAL(13, testFormat(output, "Hello world\r\n"));
  TEST_ASSERT_EQUAL_STRING("Hello world\r\n", output);
}
예제 #20
0
TEST(xformatc, DoubleFormat2) {
  char output[80];
  TEST_ASSERT_EQUAL(20, testFormat(output, "double: %.9f\n", 1.0 / 3.0));
  TEST_ASSERT_EQUAL_STRING("double: 0.333333333\n", output);
}
예제 #21
0
int main(void)
{
    static int value;
    static void * ptr = &value;
    int stackValue;
    void * stackPtr = &stackValue;


    printf("XFORMATC test\n\n");
    testFormat("Hello world %u",sizeof(unsigned long));
    testFormat("Hello %s","World");
    testFormat("String %4.4s","Large");
    testFormat("String %*.*s",4,4,"Hello");
    testFormat("integer %05d %+d %d %2d %5d",-7,7,-7,1234,1234);
    testFormat("Integer %+05d %-5d % 5d %05d",1234,1234,1234,1234);
    testFormat("Integer blank % d % d",1,-1);
    testFormat("Unsigned %u %lu",123,123Lu);
    testFormat("Hex with prefix %#x %#x %#X %#08x",0,1,2,12345678);
    testFormat("Octal %o %lo",123,123456L);
    testFormat("Octal with prefix %#o %#o",0,5);
    testFormat("Hex %x %X %lX",0x1234,0xf0ad,0xf2345678L);
    testFormat("Special char %%");
    testFormat("Size    of void * %u(%u)",(size_t)sizeof(void *),(size_t)sizeof(void *));
    testFormat("Sizeof char=%d short=%d int=%d long=%d void*=%u size_t=%u",
               sizeof(char),sizeof(short),sizeof(int),sizeof(long),sizeof(void *),sizeof(size_t));

#if XCFG_FORMAT_FLOAT

    testFormat("Floating %6.2f",22.0/7.0);
    testFormat("Floating %6.2f",-22.0/7.0);
    testFormat("Floating %+6.1f %6.2f",3.999,-3.999);
    testFormat("Floating %6.1f %6.0f",3.999,-3.999);
#endif

    testFormat("*Sizeof of void * %zu",sizeof(void *));
    testFormat("*Binary number %b %#b",5,6);
    testFormat("*Stack  ptr %p %P",stackPtr,stackPtr);
    testFormat("*Static ptr %p %P",ptr,ptr);
    testFormat("*Text   ptr %p %P",xvformat,xvformat);
    testFormat("*boolean %B %B",1,0);
    testFormat("*Text pointer as sizeof %zX",xvformat);

#if XCFG_FORMAT_LONGLONG
    testFormat("long long int %lld",(long long)123);
    testFormat("long long int %lld",(long long)-123);
    testFormat("long long hex %#llx",(long long)0x123456789abcdef);
    testFormat("long long hex %#llX",(long long)0x123456789abcdef);
#endif
    printf("\nTest completed succesfuylly\n");

    return 0;
}
예제 #22
0
static int testFormatHelper(const void *opaque)
{
    const struct testFormatData *data = opaque;
    return testFormat(data->addr, data->addrstr, data->pass);
}
예제 #23
0
TEST(xformatc, HexHandling) {
  char output[50];
  TEST_ASSERT_EQUAL(22, testFormat(output,
                                   "hex %x = ff, hex02=%02x\n", 0xff, 2));
  TEST_ASSERT_EQUAL_STRING("hex ff = ff, hex02=02\n", output);
}
예제 #24
0
TEST(xformatc, UnknownFormat) {
  char output[5];
  TEST_ASSERT_EQUAL(1, testFormat(output, "%q"));
  TEST_ASSERT_EQUAL_STRING("q", output);
}
예제 #25
0
TEST(xformatc, DoubleNoFormat) {
  char output[80];
  TEST_ASSERT_EQUAL(20, testFormat(output,
                                   "double: %f\n", 1234.56789));
  TEST_ASSERT_EQUAL_STRING("double: 1234.567890\n", output);
}