netatalk  4.4.2
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
bstest.c File Reference
#include "bstraux.h"
#include "bstrlib.h"
#include <check.h>
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

Data Structures

struct  sbstr
struct  tagBss
struct  emuFile

Macros

#define EMPTY_STRING   ""
#define SHORT_STRING   "bogus"
#define EIGHT_CHAR_STRING   "Waterloo"
#define LONG_STRING
#define LOTS_OF_S

Functions

static void test0_0 (const char *s, const char *res)
static void test0_1 (const char *s, int len, const char *res)
 START_TEST (core_000)
static END_TEST void test1_0 (const void *blk, int len, const char *res)
 START_TEST (core_001)
static END_TEST void test2_0 (const bstring b, char z, const unsigned char *res)
 START_TEST (core_002)
static END_TEST void test3_0 (const bstring b)
 START_TEST (core_003)
static END_TEST void test4_0 (const bstring b, int left, int len, const char *res)
 START_TEST (core_004)
static END_TEST void test5_0 (bstring b0, const bstring b1, const char *res)
static void test5_1 (void)
 START_TEST (core_005)
static END_TEST void test6_0 (bstring b, char c, const char *res)
 START_TEST (core_006)
static END_TEST void test7x8_0 (int(*fnptr)(const bstring, const bstring), const bstring b0, const bstring b1, int res)
static void test7x8 (int(*fnptr)(const bstring, const bstring), int retFail, int retLT, int retGT, int retEQ)
 START_TEST (core_007)
END_TEST START_TEST (core_008)
static END_TEST void test9_0 (const bstring b0, const bstring b1, int n, int res)
 START_TEST (core_009)
static END_TEST void test10_0 (bstring b, int res, int nochange)
 START_TEST (core_010)
static END_TEST void test11_0 (bstring s1, int pos, const bstring s2, int res)
static void test11_1 (bstring s1, int pos, const bstring s2, int res)
 START_TEST (core_011)
static END_TEST void test12_0 (bstring s1, int pos, const bstring s2, int res)
static void test12_1 (bstring s1, int pos, const bstring s2, int res)
 START_TEST (core_012)
static END_TEST void test13_0 (bstring s1, int pos, const bstring s2, int res)
 START_TEST (core_013)
static END_TEST void test14_0 (bstring s1, int pos, const bstring s2, int res)
 START_TEST (core_014)
static END_TEST void test15_0 (bstring b0, int pos, const bstring b1, unsigned char fill, char *res)
 START_TEST (core_015)
static END_TEST void test16_0 (bstring b0, int pos, const bstring b1, unsigned char fill, char *res)
 START_TEST (core_016)
static END_TEST void test17_0 (bstring s1, int pos, int len, char *res)
 START_TEST (core_017)
static END_TEST void test18_0 (bstring b, int len, int res, int mlen)
static void test18_1 (bstring b, int len, int res, int mlen)
 START_TEST (core_018)
static END_TEST void test19_0 (bstring b, int len, const char *res, int erv)
 START_TEST (core_019)
END_TEST START_TEST (core_020)
static END_TEST void test21_0 (bstring b, char sc, int ns)
static void test21_1 (bstring b, const bstring sc, int ns)
 START_TEST (core_021)
static END_TEST void test22_0 (const bstring b, const bstring sep, int ns,...)
 START_TEST (core_022)
static size_t test23_aux_read (void *buff, size_t elsize, size_t nelem, void *parm)
static int test23_aux_open (struct sbstr *sb, bstring b)
static int test23_aux_splitcb (void *parm, BSTR_UNUSED int ofs, const bstring entry)
static int test23_aux_splitcbx (void *parm, BSTR_UNUSED int ofs, const bstring entry)
 START_TEST (core_023)
static END_TEST void test24_0 (bstring s1, int pos, const bstring s2, int res)
 START_TEST (core_024)
static END_TEST void test25_0 (bstring s1, int pos, const bstring s2, int res)
 START_TEST (core_025)
static END_TEST void test26_0 (bstring b0, int pos, int len, const bstring b1, unsigned char fill, char *res)
 START_TEST (core_026)
static END_TEST void test27_0 (bstring b0, const bstring b1, const char *res)
 START_TEST (core_027)
static END_TEST void test28_0 (bstring s1, int c, int res)
static void test28_1 (bstring s1, int c, int res)
static void test28_2 (bstring s1, int c, int pos, int res)
static void test28_3 (bstring s1, int c, int pos, int res)
 START_TEST (core_028)
static END_TEST void test29_0 (bstring b0, char *s, const char *res)
 START_TEST (core_029)
static END_TEST void test30_0 (bstring b0, const unsigned char *s, int len, const char *res)
 START_TEST (core_030)
static END_TEST void test31_0 (bstring b0, const bstring find, const bstring replace, int pos, char *res)
static void test31_1 (bstring b0, const bstring find, const bstring replace, int pos, char *res)
 START_TEST (core_031)
static END_TEST void test32_0 (const bstring b, const char *s, int res)
static void test32_1 (const bstring b, const char *s, int res)
 START_TEST (core_032)
static END_TEST void test33_0 (bstring b0, const char *res)
 START_TEST (core_033)
static END_TEST void test34_0 (bstring b0, const char *res)
 START_TEST (core_034)
static END_TEST void test35_0 (const bstring b0, const bstring b1, int res)
 START_TEST (core_035)
static END_TEST void test36_0 (const bstring b0, const bstring b1, int n, int res)
 START_TEST (core_036)
static END_TEST void test37_0 (const bstring b0, const bstring b1, int res)
 START_TEST (core_037)
static int test38_aux_bngetc (struct emuFile *f)
static size_t test38_aux_bnread (void *buff, size_t elsize, size_t nelem, struct emuFile *f)
static int test38_aux_bnopen (struct emuFile *f, bstring b)
 START_TEST (core_038)
static END_TEST void test39_0 (const bstring b, const bstring lt, const bstring rt, const bstring t)
 START_TEST (core_039)
static END_TEST void test40_0 (bstring b0, const bstring b1, int left, int len, const char *res)
 START_TEST (core_040)
static END_TEST void test41_0 (bstring b1, int left, int len)
 START_TEST (core_041)
static END_TEST void test42_0 (const bstring bi, int len, const char *res)
 START_TEST (core_042)
END_TEST START_TEST (core_043)
static END_TEST void test44_0 (const char *str)
 START_TEST (core_044)
static END_TEST void test45_0 (const char *str)
 START_TEST (core_045)
static END_TEST void test46_0 (const bstring r, bstring b, int count, const char *fmt,...)
static void test46_1 (bstring b, const char *fmt, const bstring r,...)
 START_TEST (core_046)
END_TEST int main (void)

Variables

struct tagbstring emptyBstring = bsStatic(EMPTY_STRING)
struct tagbstring shortBstring = bsStatic(SHORT_STRING)
struct tagbstring longBstring = bsStatic(LONG_STRING)
struct tagbstring badBstring1
struct tagbstring badBstring2
struct tagbstring badBstring3
struct tagbstring xxxxxBstring = bsStatic("xxxxx")

Macro Definition Documentation

◆ EIGHT_CHAR_STRING

#define EIGHT_CHAR_STRING   "Waterloo"

◆ EMPTY_STRING

#define EMPTY_STRING   ""

◆ LONG_STRING

#define LONG_STRING
Value:
"This is a bogus but reasonably long string. " \
"Just long enough to cause some mallocing."

◆ LOTS_OF_S

#define LOTS_OF_S
Value:
"sssssssssssssssssssssssssssssssss" \
"sssssssssssssssssssssssssssssssss"

◆ SHORT_STRING

#define SHORT_STRING   "bogus"

Function Documentation

◆ main()

END_TEST int main ( void )

◆ START_TEST() [1/47]

START_TEST ( core_000 )

◆ START_TEST() [2/47]

START_TEST ( core_001 )

◆ START_TEST() [3/47]

START_TEST ( core_002 )

◆ START_TEST() [4/47]

START_TEST ( core_003 )

◆ START_TEST() [5/47]

START_TEST ( core_004 )

◆ START_TEST() [6/47]

START_TEST ( core_005 )

◆ START_TEST() [7/47]

START_TEST ( core_006 )

◆ START_TEST() [8/47]

START_TEST ( core_007 )

◆ START_TEST() [9/47]

END_TEST START_TEST ( core_008 )

◆ START_TEST() [10/47]

START_TEST ( core_009 )

◆ START_TEST() [11/47]

START_TEST ( core_010 )

◆ START_TEST() [12/47]

START_TEST ( core_011 )

◆ START_TEST() [13/47]

START_TEST ( core_012 )

◆ START_TEST() [14/47]

START_TEST ( core_013 )

◆ START_TEST() [15/47]

START_TEST ( core_014 )

◆ START_TEST() [16/47]

START_TEST ( core_015 )

◆ START_TEST() [17/47]

START_TEST ( core_016 )

◆ START_TEST() [18/47]

START_TEST ( core_017 )

◆ START_TEST() [19/47]

START_TEST ( core_018 )

◆ START_TEST() [20/47]

START_TEST ( core_019 )

◆ START_TEST() [21/47]

END_TEST START_TEST ( core_020 )

◆ START_TEST() [22/47]

START_TEST ( core_021 )

◆ START_TEST() [23/47]

START_TEST ( core_022 )

◆ START_TEST() [24/47]

START_TEST ( core_023 )

◆ START_TEST() [25/47]

START_TEST ( core_024 )

◆ START_TEST() [26/47]

START_TEST ( core_025 )

◆ START_TEST() [27/47]

START_TEST ( core_026 )

◆ START_TEST() [28/47]

START_TEST ( core_027 )

◆ START_TEST() [29/47]

START_TEST ( core_028 )

◆ START_TEST() [30/47]

START_TEST ( core_029 )

◆ START_TEST() [31/47]

START_TEST ( core_030 )

◆ START_TEST() [32/47]

START_TEST ( core_031 )

◆ START_TEST() [33/47]

START_TEST ( core_032 )

◆ START_TEST() [34/47]

START_TEST ( core_033 )

◆ START_TEST() [35/47]

START_TEST ( core_034 )

◆ START_TEST() [36/47]

START_TEST ( core_035 )

◆ START_TEST() [37/47]

START_TEST ( core_036 )

◆ START_TEST() [38/47]

START_TEST ( core_037 )

◆ START_TEST() [39/47]

START_TEST ( core_038 )

◆ START_TEST() [40/47]

START_TEST ( core_039 )

◆ START_TEST() [41/47]

START_TEST ( core_040 )

◆ START_TEST() [42/47]

START_TEST ( core_041 )

◆ START_TEST() [43/47]

START_TEST ( core_042 )

◆ START_TEST() [44/47]

END_TEST START_TEST ( core_043 )

◆ START_TEST() [45/47]

START_TEST ( core_044 )

◆ START_TEST() [46/47]

START_TEST ( core_045 )

◆ START_TEST() [47/47]

START_TEST ( core_046 )

◆ test0_0()

void test0_0 ( const char * s,
const char * res )
static

◆ test0_1()

void test0_1 ( const char * s,
int len,
const char * res )
static

◆ test10_0()

END_TEST void test10_0 ( bstring b,
int res,
int nochange )
static

◆ test11_0()

END_TEST void test11_0 ( bstring s1,
int pos,
const bstring s2,
int res )
static

◆ test11_1()

void test11_1 ( bstring s1,
int pos,
const bstring s2,
int res )
static

◆ test12_0()

END_TEST void test12_0 ( bstring s1,
int pos,
const bstring s2,
int res )
static

◆ test12_1()

void test12_1 ( bstring s1,
int pos,
const bstring s2,
int res )
static

◆ test13_0()

END_TEST void test13_0 ( bstring s1,
int pos,
const bstring s2,
int res )
static

◆ test14_0()

END_TEST void test14_0 ( bstring s1,
int pos,
const bstring s2,
int res )
static

◆ test15_0()

END_TEST void test15_0 ( bstring b0,
int pos,
const bstring b1,
unsigned char fill,
char * res )
static

◆ test16_0()

END_TEST void test16_0 ( bstring b0,
int pos,
const bstring b1,
unsigned char fill,
char * res )
static

◆ test17_0()

END_TEST void test17_0 ( bstring s1,
int pos,
int len,
char * res )
static

◆ test18_0()

END_TEST void test18_0 ( bstring b,
int len,
int res,
int mlen )
static

◆ test18_1()

void test18_1 ( bstring b,
int len,
int res,
int mlen )
static

◆ test19_0()

END_TEST void test19_0 ( bstring b,
int len,
const char * res,
int erv )
static

◆ test1_0()

END_TEST void test1_0 ( const void * blk,
int len,
const char * res )
static

◆ test21_0()

END_TEST void test21_0 ( bstring b,
char sc,
int ns )
static

◆ test21_1()

void test21_1 ( bstring b,
const bstring sc,
int ns )
static

◆ test22_0()

END_TEST void test22_0 ( const bstring b,
const bstring sep,
int ns,
... )
static

◆ test23_aux_open()

int test23_aux_open ( struct sbstr * sb,
bstring b )
static

◆ test23_aux_read()

size_t test23_aux_read ( void * buff,
size_t elsize,
size_t nelem,
void * parm )
static

◆ test23_aux_splitcb()

int test23_aux_splitcb ( void * parm,
BSTR_UNUSED int ofs,
const bstring entry )
static

◆ test23_aux_splitcbx()

int test23_aux_splitcbx ( void * parm,
BSTR_UNUSED int ofs,
const bstring entry )
static

◆ test24_0()

END_TEST void test24_0 ( bstring s1,
int pos,
const bstring s2,
int res )
static

◆ test25_0()

END_TEST void test25_0 ( bstring s1,
int pos,
const bstring s2,
int res )
static

◆ test26_0()

END_TEST void test26_0 ( bstring b0,
int pos,
int len,
const bstring b1,
unsigned char fill,
char * res )
static

◆ test27_0()

END_TEST void test27_0 ( bstring b0,
const bstring b1,
const char * res )
static

◆ test28_0()

END_TEST void test28_0 ( bstring s1,
int c,
int res )
static

◆ test28_1()

void test28_1 ( bstring s1,
int c,
int res )
static

◆ test28_2()

void test28_2 ( bstring s1,
int c,
int pos,
int res )
static

◆ test28_3()

void test28_3 ( bstring s1,
int c,
int pos,
int res )
static

◆ test29_0()

END_TEST void test29_0 ( bstring b0,
char * s,
const char * res )
static

◆ test2_0()

END_TEST void test2_0 ( const bstring b,
char z,
const unsigned char * res )
static

◆ test30_0()

END_TEST void test30_0 ( bstring b0,
const unsigned char * s,
int len,
const char * res )
static

◆ test31_0()

END_TEST void test31_0 ( bstring b0,
const bstring find,
const bstring replace,
int pos,
char * res )
static

◆ test31_1()

void test31_1 ( bstring b0,
const bstring find,
const bstring replace,
int pos,
char * res )
static

◆ test32_0()

END_TEST void test32_0 ( const bstring b,
const char * s,
int res )
static

◆ test32_1()

void test32_1 ( const bstring b,
const char * s,
int res )
static

◆ test33_0()

END_TEST void test33_0 ( bstring b0,
const char * res )
static

◆ test34_0()

END_TEST void test34_0 ( bstring b0,
const char * res )
static

◆ test35_0()

END_TEST void test35_0 ( const bstring b0,
const bstring b1,
int res )
static

◆ test36_0()

END_TEST void test36_0 ( const bstring b0,
const bstring b1,
int n,
int res )
static

◆ test37_0()

END_TEST void test37_0 ( const bstring b0,
const bstring b1,
int res )
static

◆ test38_aux_bngetc()

int test38_aux_bngetc ( struct emuFile * f)
static

◆ test38_aux_bnopen()

int test38_aux_bnopen ( struct emuFile * f,
bstring b )
static

◆ test38_aux_bnread()

size_t test38_aux_bnread ( void * buff,
size_t elsize,
size_t nelem,
struct emuFile * f )
static

◆ test39_0()

END_TEST void test39_0 ( const bstring b,
const bstring lt,
const bstring rt,
const bstring t )
static

◆ test3_0()

END_TEST void test3_0 ( const bstring b)
static

◆ test40_0()

END_TEST void test40_0 ( bstring b0,
const bstring b1,
int left,
int len,
const char * res )
static

◆ test41_0()

END_TEST void test41_0 ( bstring b1,
int left,
int len )
static

◆ test42_0()

END_TEST void test42_0 ( const bstring bi,
int len,
const char * res )
static

◆ test44_0()

END_TEST void test44_0 ( const char * str)
static

◆ test45_0()

END_TEST void test45_0 ( const char * str)
static

◆ test46_0()

END_TEST void test46_0 ( const bstring r,
bstring b,
int count,
const char * fmt,
... )
static

◆ test46_1()

void test46_1 ( bstring b,
const char * fmt,
const bstring r,
... )
static

◆ test4_0()

END_TEST void test4_0 ( const bstring b,
int left,
int len,
const char * res )
static

◆ test5_0()

END_TEST void test5_0 ( bstring b0,
const bstring b1,
const char * res )
static

◆ test5_1()

void test5_1 ( void )
static

◆ test6_0()

END_TEST void test6_0 ( bstring b,
char c,
const char * res )
static

◆ test7x8()

void test7x8 ( int(* fnptr )(const bstring, const bstring),
int retFail,
int retLT,
int retGT,
int retEQ )
static

◆ test7x8_0()

END_TEST void test7x8_0 ( int(* fnptr )(const bstring, const bstring),
const bstring b0,
const bstring b1,
int res )
static

◆ test9_0()

END_TEST void test9_0 ( const bstring b0,
const bstring b1,
int n,
int res )
static

Variable Documentation

◆ badBstring1

struct tagbstring badBstring1
Initial value:
= {
8,
4,
(unsigned char *)NULL
}

◆ badBstring2

struct tagbstring badBstring2
Initial value:
= {
2,
-5,
(unsigned char *)SHORT_STRING
}
#define SHORT_STRING
Definition bstest.c:98

◆ badBstring3

struct tagbstring badBstring3
Initial value:
= {
2,
5,
(unsigned char *)SHORT_STRING
}

◆ emptyBstring

struct tagbstring emptyBstring = bsStatic(EMPTY_STRING)

◆ longBstring

struct tagbstring longBstring = bsStatic(LONG_STRING)

◆ shortBstring

struct tagbstring shortBstring = bsStatic(SHORT_STRING)

◆ xxxxxBstring

struct tagbstring xxxxxBstring = bsStatic("xxxxx")