1 #!/bin/ksh
   2 #
   3 # This file and its contents are supplied under the terms of the
   4 # Common Development and Distribution License ("CDDL"), version 1.0.
   5 # You may only use this file in accordance with the terms of version
   6 # 1.0 of the CDDL.
   7 #
   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 #
  14 # Copyright (c) 2014, Joyent, Inc.
  15 #
  16 
  17 DIR=$(dirname $(whence $0))
  18 . ${DIR}/json_common
  19 
  20 BASELINE="$(cat <<EOF
  21 {\
  22 "byte_array":[0,1,2,10,15,100,103,127,128,254,255],\
  23 "uint8_array":[128,254,255,10,15,100,103,127,0,1,2],\
  24 "uint16_array":[0,1000,2000,3210,4321,5432,10000,15000,16384,\
  25 17992,35012,65535,0],\
  26 "uint32_array":[0,4294967295,4026531855,1,2,1000,501],\
  27 "uint64_array":[19850907,0,18446744073709551615],\
  28 "int8_array":[39,39,39,39,39,39,39,-128,-127,0,127],\
  29 "int16_array":[7532,-32768,0,32767,0,-32768,100],\
  30 "int32_array":[-2147483648,0,32767,-32768,2147483647],\
  31 "int64_array":[0,0,9223372036854775807,1,1,1,-9223372036854775808,0]\
  32 }
  33 EOF)"
  34 
  35 OUTPUT="$(${DIR}/../../bin/print_json <<'EOF'
  36 add_byte_array "byte_array"
  37   "0" "1" "2" "10" "15" "100" "103" "127" "128" "254" "255";
  38 
  39 add_uint8_array "uint8_array"
  40   "128" "254" "255" "10" "15" "100" "103" "127" "0" "1" "2";
  41 
  42 add_uint16_array "uint16_array"
  43   "0" "1000" "2000" "3210" "4321" "5432" "10000" "15000" "16384"
  44   "17992" "35012" "65535" "0";
  45 
  46 add_uint32_array "uint32_array"
  47   "0" "4294967295" "4026531855" "1" "2" "1000" "501";
  48 
  49 add_uint64_array "uint64_array"
  50   "19850907" "0" "18446744073709551615";
  51 
  52 add_int8_array "int8_array"
  53   "39" "39" "39" "39" "39" "39" "39" "-128" "-127" "0" "127";
  54 
  55 add_int16_array "int16_array"
  56   "7532" "-32768" "0" "32767" "0" "-32768" "100";
  57 
  58 add_int32_array "int32_array"
  59   "-2147483648" "0" "32767" "-32768" "2147483647";
  60 
  61 add_int64_array "int64_array"
  62   "0" "0" "9223372036854775807" "1" "1" "1" "-9223372036854775808" "0";
  63 EOF)"
  64 
  65 complete