Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Macros | Functions | Variables
0.printf.cpp File Reference
#include <rw_environ.h>
#include <rw_printf.h>
#include <rw_process.h>
#include <rw_value.h>
#include <bitset>
#include <ios>
#include <string>
#include <locale>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>
#include <wchar.h>
Include dependency graph for 0.printf.cpp:

Go to the source code of this file.

Macros

#define _RWSTD_NO_SPRINTFA_FUNNAME
 
#define TEST(fmt, a1, a2, a3, expect)    do_test (__LINE__, fmt, expect, rw_sprintfa (fmt, a1, a2, a3))
 
#define TEST_SPEC(pfx, a1, a2, a3, expect)
 
#define ARG   mkargv
 
#define S(s)   &(str = std::string (s, sizeof s - 1))
 
#define WS(ws)    &(wstr = std::wstring (L ## ws, sizeof L ## ws / sizeof (wchar_t) - 1))
 
#define BASE(n)   ((n) << _RWSTD_IOS_BASEOFF)
 
#define BS(str)   mkbitset (str)
 
#define ADD_ELEMENT(n)
 
#define AR   make_array
 
#define SET_ELEM(inx, val)
 
#define TM   make_tm
 
#define TEST(fmt, a1, a2, a3, expect)    do_test (__LINE__, fmt, expect, rw_sprintfa (fmt, cwidth, a1, a2, a3))
 
#define TEST(fmt, a1, a2, a3, expect)    do_test (__LINE__, fmt, expect, rw_sprintfa (fmt, a1, a2, a3))
 

Functions

const void * bad_address (size_t size)
 
const char * format_bad_address (const void *ptr, bool valid)
 
void * make_array (int width, int a0=0, int a1=0, int a2=0, int a3=0, int a4=0, int a5=0, int a6=0, int a7=0, int a8=0, int a9=0, int a10=0, int a11=0, int a12=0, int a13=0, int a14=0, int a15=0)
 
int test_function (int i)
 
int main ()
 

Variables

int ntests
 
int nfailures
 

Macro Definition Documentation

◆ _RWSTD_NO_SPRINTFA_FUNNAME

#define _RWSTD_NO_SPRINTFA_FUNNAME

0.printf.cpp - test exercising the rw_snprinfa() utility functions

$Id$

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2005-2008 Rogue Wave Software, Inc.

Definition at line 58 of file 0.printf.cpp.

◆ ADD_ELEMENT

#define ADD_ELEMENT (   n)
Value:
switch (width) { \
case 8 /* bytes */: *ptr.pi64++ = i64_t (a##n); break; \
case 4 /* bytes */: *ptr.pi32++ = i32_t (a##n); break; \
case 2 /* bytes */: *ptr.pi16++ = i16_t (a##n); break; \
case 1 /* byte */: *ptr.pi8++ = i8_t (a##n); break; \
} (void)0
#define ptr
Definition 17.names.cpp:525
#define a
Definition 17.names.cpp:109
#define n
Definition 17.names.cpp:130

◆ AR

#define AR   make_array

◆ ARG

#define ARG   mkargv

◆ BASE

#define BASE (   n)    ((n) << _RWSTD_IOS_BASEOFF)

◆ BS

#define BS (   str)    mkbitset (str)

◆ S

#define S (   s)    &(str = std::string (s, sizeof s - 1))

◆ SET_ELEM

#define SET_ELEM (   inx,
  val 
)
Value:
RW_ASSERT (unsigned (inx) < array_size); \
array8 [inx] = val; array16 [inx] = val; \
array32 [inx] = val; \
array_str [inx * 2] = '0' + val
#define inx
Definition 17.names.cpp:484
#define val
Definition 17.names.cpp:570
#define RW_ASSERT(expr)

◆ TEST [1/3]

#define TEST (   fmt,
  a1,
  a2,
  a3,
  expect 
)     do_test (__LINE__, fmt, expect, rw_sprintfa (fmt, a1, a2, a3))

Definition at line 126 of file 0.printf.cpp.

◆ TEST [2/3]

#define TEST (   fmt,
  a1,
  a2,
  a3,
  expect 
)     do_test (__LINE__, fmt, expect, rw_sprintfa (fmt, cwidth, a1, a2, a3))

Definition at line 126 of file 0.printf.cpp.

◆ TEST [3/3]

#define TEST (   fmt,
  a1,
  a2,
  a3,
  expect 
)     do_test (__LINE__, fmt, expect, rw_sprintfa (fmt, a1, a2, a3))

Definition at line 126 of file 0.printf.cpp.

◆ TEST_SPEC

#define TEST_SPEC (   pfx,
  a1,
  a2,
  a3,
  expect 
)
Value:
{ \
++ntests; \
char fmt [64]; \
sprintf (fmt, "%s%c", pfx, spec); \
char* const s0 = rw_sprintfa (fmt, a1, a2, a3); \
char buf [256]; \
/* non-const variable below avoids warnings about */ \
/* controlling expression being constant */ \
const char* /* const */ expect_var = (expect); \
if (expect_var) \
strcpy (buf, expect_var ? expect_var : ""); \
else \
sprintf (buf, fmt, a1, a2, a3); \
const int result = memcmp (buf, s0, strlen (buf) + 1); \
if (result) { \
++nfailures; \
fprintf (stderr, \
"# Assertion failed on line %d: " \
"rw_printf(\"%s\", %ld, %ld, %ld) " \
"== \"%s\", got \"%s\"\n", \
__LINE__, fmt, \
(long)a1, (long)a2, (long)a3, buf, s0); \
} \
free (s0); \
} (void)0 /* require semicolon after macro invocation */
int ntests
Definition 0.printf.cpp:62
int nfailures
Definition 0.printf.cpp:63
#define buf
Definition 17.names.cpp:452
#define a2
Definition 17.names.cpp:251
#define a1
Definition 17.names.cpp:225
volatile int result
@ s0
Definition HONOR_STD.cpp:38
#define stderr
_TEST_EXPORT char * rw_sprintfa(const char *fmt,...)
Definition printf.cpp:3258

Definition at line 130 of file 0.printf.cpp.

◆ TM

#define TM   make_tm

◆ WS

#define WS (   ws)     &(wstr = std::wstring (L ## ws, sizeof L ## ws / sizeof (wchar_t) - 1))

Function Documentation

◆ bad_address()

const void * bad_address ( size_t  size)

Definition at line 160 of file 0.printf.cpp.

◆ format_bad_address()

const char * format_bad_address ( const void *  ptr,
bool  valid 
)

Definition at line 189 of file 0.printf.cpp.

◆ main()

int main ( void  )

Definition at line 3492 of file 0.printf.cpp.

◆ make_array()

void * make_array ( int  width,
int  a0 = 0,
int  a1 = 0,
int  a2 = 0,
int  a3 = 0,
int  a4 = 0,
int  a5 = 0,
int  a6 = 0,
int  a7 = 0,
int  a8 = 0,
int  a9 = 0,
int  a10 = 0,
int  a11 = 0,
int  a12 = 0,
int  a13 = 0,
int  a14 = 0,
int  a15 = 0 
)

Definition at line 1715 of file 0.printf.cpp.

◆ test_function()

int test_function ( int  i)

Definition at line 2008 of file 0.printf.cpp.

Variable Documentation

◆ nfailures

int nfailures

Definition at line 63 of file 0.printf.cpp.

◆ ntests

int ntests

Definition at line 62 of file 0.printf.cpp.