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":255,\
  23 "uint8_0":0,\
  24 "uint8_100":100,\
  25 "uint8_255":255,\
  26 "uint16":12345,\
  27 "uint32":23423423,\
  28 "uint64":19850709000000,\
  29 "int16_small":-32768,\
  30 "int8_neg":-128,\
  31 "int8_pos":127,\
  32 "int16_big":32767,\
  33 "int32":-1270000,\
  34 "int64":-12700000000001,\
  35 "double_small":0.000023,\
  36 "double_big":2342300000000.000000\
  37 }
  38 EOF)"
  39 
  40 OUTPUT="$(${DIR}/../../bin/print_json <<'EOF'
  41 add_byte "byte" "0";
  42 add_byte "byte" "255";
  43 
  44 add_uint8 "uint8_0" "0";
  45 add_uint8 "uint8_100" "100";
  46 add_uint8 "uint8_255" "255";
  47 
  48 add_uint16 "uint16" "12345";
  49 add_uint32 "uint32" "23423423";
  50 add_uint64 "uint64" "19850709000000";
  51 
  52 add_int16 "int16_small" "-32768";
  53 add_int8 "int8_neg" "-128";
  54 add_int8 "int8_pos" "127";
  55 add_int16 "int16_big" "32767";
  56 
  57 add_int32 "int32" "-1270000";
  58 add_int64 "int64" "-12700000000001";
  59 
  60 add_double "double_small" "0.000023423";
  61 add_double "double_big" "0.000023423e17";
  62 EOF)"
  63 
  64 complete