$darkmode
netatalk  4.5.1
Free and Open Source Apple Filing Protocol (AFP) Server
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)
 
static void test0_2 (const char *s, int l)
 
 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)
 
static END_TEST void test47_0 (const bstring b, const unsigned char *blk, int len, int res)
 
 START_TEST (core_047)
 
static END_TEST void test48_0 (const bstring b, const unsigned char *blk, int len, int res)
 
 START_TEST (core_048)
 
static END_TEST void test49_0 (bstring b0, int pos, const void *blk, int len, unsigned char fill, const char *res, int reslen)
 
 START_TEST (core_049)
 
END_TEST START_TEST (core_050)
 
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/51]

START_TEST ( core_000  )

◆ START_TEST() [2/51]

START_TEST ( core_001  )

◆ START_TEST() [3/51]

START_TEST ( core_002  )

◆ START_TEST() [4/51]

START_TEST ( core_003  )

◆ START_TEST() [5/51]

START_TEST ( core_004  )

◆ START_TEST() [6/51]

START_TEST ( core_005  )

◆ START_TEST() [7/51]

START_TEST ( core_006  )

◆ START_TEST() [8/51]

START_TEST ( core_007  )

◆ START_TEST() [9/51]

END_TEST START_TEST ( core_008  )

◆ START_TEST() [10/51]

START_TEST ( core_009  )

◆ START_TEST() [11/51]

START_TEST ( core_010  )

◆ START_TEST() [12/51]

START_TEST ( core_011  )

◆ START_TEST() [13/51]

START_TEST ( core_012  )

◆ START_TEST() [14/51]

START_TEST ( core_013  )

◆ START_TEST() [15/51]

START_TEST ( core_014  )

◆ START_TEST() [16/51]

START_TEST ( core_015  )

◆ START_TEST() [17/51]

START_TEST ( core_016  )

◆ START_TEST() [18/51]

START_TEST ( core_017  )

◆ START_TEST() [19/51]

START_TEST ( core_018  )

◆ START_TEST() [20/51]

START_TEST ( core_019  )

◆ START_TEST() [21/51]

END_TEST START_TEST ( core_020  )

◆ START_TEST() [22/51]

START_TEST ( core_021  )

◆ START_TEST() [23/51]

START_TEST ( core_022  )

◆ START_TEST() [24/51]

START_TEST ( core_023  )

◆ START_TEST() [25/51]

START_TEST ( core_024  )

◆ START_TEST() [26/51]

START_TEST ( core_025  )

◆ START_TEST() [27/51]

START_TEST ( core_026  )

◆ START_TEST() [28/51]

START_TEST ( core_027  )

◆ START_TEST() [29/51]

START_TEST ( core_028  )

◆ START_TEST() [30/51]

START_TEST ( core_029  )

◆ START_TEST() [31/51]

START_TEST ( core_030  )

◆ START_TEST() [32/51]

START_TEST ( core_031  )

◆ START_TEST() [33/51]

START_TEST ( core_032  )

◆ START_TEST() [34/51]

START_TEST ( core_033  )

◆ START_TEST() [35/51]

START_TEST ( core_034  )

◆ START_TEST() [36/51]

START_TEST ( core_035  )

◆ START_TEST() [37/51]

START_TEST ( core_036  )

◆ START_TEST() [38/51]

START_TEST ( core_037  )

◆ START_TEST() [39/51]

START_TEST ( core_038  )

◆ START_TEST() [40/51]

START_TEST ( core_039  )

◆ START_TEST() [41/51]

START_TEST ( core_040  )

◆ START_TEST() [42/51]

START_TEST ( core_041  )

◆ START_TEST() [43/51]

START_TEST ( core_042  )

◆ START_TEST() [44/51]

END_TEST START_TEST ( core_043  )

◆ START_TEST() [45/51]

START_TEST ( core_044  )

◆ START_TEST() [46/51]

START_TEST ( core_045  )

◆ START_TEST() [47/51]

START_TEST ( core_046  )

◆ START_TEST() [48/51]

START_TEST ( core_047  )

◆ START_TEST() [49/51]

START_TEST ( core_048  )

◆ START_TEST() [50/51]

START_TEST ( core_049  )

◆ START_TEST() [51/51]

END_TEST START_TEST ( core_050  )

◆ test0_0()

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

◆ test0_1()

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

◆ test0_2()

static void test0_2 ( const char *  s,
int  l 
)
static

◆ test10_0()

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

◆ test11_0()

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

◆ test11_1()

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

◆ test12_0()

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

◆ test12_1()

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

◆ test13_0()

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

◆ test14_0()

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

◆ test15_0()

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

◆ test16_0()

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

◆ test17_0()

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

◆ test18_0()

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

◆ test18_1()

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

◆ test19_0()

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

◆ test1_0()

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

◆ test21_0()

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

◆ test21_1()

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

◆ test22_0()

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

◆ test23_aux_open()

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

◆ test23_aux_read()

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

◆ test23_aux_splitcb()

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

◆ test23_aux_splitcbx()

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

◆ test24_0()

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

◆ test25_0()

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

◆ test26_0()

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

◆ test27_0()

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

◆ test28_0()

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

◆ test28_1()

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

◆ test28_2()

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

◆ test28_3()

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

◆ test29_0()

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

◆ test2_0()

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

◆ test30_0()

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

◆ test31_0()

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

◆ test31_1()

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

◆ test32_0()

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

◆ test32_1()

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

◆ test33_0()

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

◆ test34_0()

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

◆ test35_0()

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

◆ test36_0()

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

◆ test37_0()

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

◆ test38_aux_bngetc()

static int test38_aux_bngetc ( struct emuFile f)
static

◆ test38_aux_bnopen()

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

◆ test38_aux_bnread()

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

◆ test39_0()

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

◆ test3_0()

static END_TEST void test3_0 ( const bstring  b)
static

◆ test40_0()

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

◆ test41_0()

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

◆ test42_0()

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

◆ test44_0()

static END_TEST void test44_0 ( const char *  str)
static

◆ test45_0()

static END_TEST void test45_0 ( const char *  str)
static

◆ test46_0()

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

◆ test46_1()

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

◆ test47_0()

static END_TEST void test47_0 ( const bstring  b,
const unsigned char *  blk,
int  len,
int  res 
)
static

◆ test48_0()

static END_TEST void test48_0 ( const bstring  b,
const unsigned char *  blk,
int  len,
int  res 
)
static

◆ test49_0()

static END_TEST void test49_0 ( bstring  b0,
int  pos,
const void *  blk,
int  len,
unsigned char  fill,
const char *  res,
int  reslen 
)
static

◆ test4_0()

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

◆ test5_0()

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

◆ test5_1()

static void test5_1 ( void  )
static

◆ test6_0()

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

◆ test7x8()

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

◆ test7x8_0()

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

◆ test9_0()

static 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
}
#define NULL
Definition: utf8util.c:47

◆ 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")