update new function examples and add scenarios

This commit is contained in:
Jonathan Shook 2021-04-21 18:25:29 -05:00
parent 9589a80a79
commit 37d3e3937b
2 changed files with 38 additions and 31 deletions

View File

@ -1,32 +1,41 @@
description: | description: |
This is a set of example for how to create or use This is a set of example for how to create or use ByteBuffers in various ways.
ByteBuffers in various ways.
scenarios:
default: run driver=stdout format=readout
bindings: bindings:
# To see the cycle correspondence with
cycle: Identity() cycle: Identity()
# ToHexString() is added to many of these so that you can see the data
# in the byte buffers. To send a byte buffer object to a driver,
# be sure to remove the ToHexString() functions.
# fill a byte buffer of the given size with hashed longs # fill a byte buffer of the given size with hashed longs
# Hashing is incremental, not recursive, thus data looks # Hashing is incremental, not recursive, thus data looks
# like a sliding window over values # like a sliding window over values
hashed_bb: ByteBufferSizedHashed(1000); hashed_bb: ByteBufferSizedHashed(30); ToHexString();
# control the size of the extracted sample with a hash range # control the size of the extracted sample with a hash range
hashed_bb_sizerange: ByteBufferSizedHashed(HashRange(1,10)) hashed_bb_sizerange: ByteBufferSizedHashed(HashRange(1,10)); ToHexString();
# control the size of the extracted sample based on a continuous function # control the size of the extracted sample based on a continuous function
hashed_bb_size_normal: ByteBufferSizedHashed(Normal(5.0, 1.0)) hashed_bb_size_normal: ByteBufferSizedHashed(Normal(5.0, 1.0)); ToHexString();
# control the size of the extracted sample based on a discrete function # control the size of the extracted sample based on a discrete function
hashed_bb_size_binomial: ByteBufferSizedHashed(Binomial(8,0.5)) hashed_bb_size_binomial: ByteBufferSizedHashed(Binomial(8,0.5)); ToHexString();
# convert a ByteBuffer to a hex-encoded string with upper case # convert a ByteBuffer to a hex-encoded string with upper case
bb_to_hex_uc: ByteBufferSizedHashed(1000); ToHexString(); bb_to_hex_uc: ByteBufferSizedHashed(20); ToHexString();
# convert a ByteBuffer to a hex-encoded string with lower case # convert a ByteBuffer to a hex-encoded string with lower case
bb_to_hex_lc: ByteBufferSizedHashed(1000); ToHexString(false); bb_to_hex_lc: ByteBufferSizedHashed(20); ToHexString(false);
# generate a byte buffer of 1000 bytes, and then compute a MD5 # generate a byte buffer of 1000 bytes, and then compute a MD5
# digest into another byte buffer # digest into another byte buffer
digest_bb: ByteBufferSizedHashed(1000); DigestToByteBuffer('MD5'); digest_bb: ByteBufferSizedHashed(1000); DigestToByteBuffer('MD5'); ToHexString();
# Md5 digest as above, but using a long as input, short-circuiting # Md5 digest as above, but using a long as input, short-circuiting
# the byte buffer construction spelled out above. This is easier # the byte buffer construction spelled out above. This is easier
@ -36,7 +45,7 @@ bindings:
digest_bb_direct: DigestToByteBuffer('MD5'); digest_bb_direct: DigestToByteBuffer('MD5');
# A canned version of the above # A canned version of the above
long_md5_bb: ToMD5ByteBuffer() long_md5_bb: ToMD5ByteBuffer(); ToHexString();
# The example below show various type-specialized ByteBuffer # The example below show various type-specialized ByteBuffer
# functions which are automatically selected depending on the # functions which are automatically selected depending on the
@ -44,32 +53,21 @@ bindings:
# long byte buffer # long byte buffer
# same as long -> ToByteBuffer() -> ByteBuffer # same as long -> ToByteBuffer() -> ByteBuffer
long_bb: ToByteBuffer(); long_bb: ToByteBuffer(); ToHexString();
# double byte buffer # double byte buffer
# same as long -> ToDouble() -> double; double -> ToByteBuffer() -> ByteBuffer # same as long -> ToDouble() -> double; double -> ToByteBuffer() -> ByteBuffer
double_bb: ToDouble(); ToByteBuffer(); double_bb: ToDouble(); ToByteBuffer(); ToHexString();
# integer byte buffer # integer byte buffer
# same as long -> ToInt() -> int; int -> ToByteBuffer() -> ByteBuffer # same as long -> ToInt() -> int; int -> ToByteBuffer() -> ByteBuffer
int_bb: ToInt(); ToByteBuffer(); int_bb: ToInt(); ToByteBuffer(); ToHexString();
# string to ByteBuffer # string to ByteBuffer
# same as long -> NumberNameToString() -> String; String -> ToByteBuffer() # same as long -> NumberNameToString() -> String; String -> ToByteBuffer()
string_bb: NumberNameToString(); ToByteBuffer(); string_bb: NumberNameToString(); ToByteBuffer(); ToHexString();
# char buffer to byte buffer # char buffer to byte buffer, another way to get the same result as above
# same as # same as
# long -> NumberNameToString() -> String; String -> ToCharBuffer() -> CharBuffer; CharBuffer -> ToByteBuffer() -> ByteBuffer # long -> NumberNameToString() -> String; String -> ToCharBuffer() -> CharBuffer; CharBuffer -> ToByteBuffer() -> ByteBuffer
cb_bb: NumberNameToString(); ToCharBuffer(); ToByteBuffer(); cb_bb: NumberNameToString(); ToCharBuffer(); ToByteBuffer(); ToHexString();

View File

@ -1,10 +1,12 @@
description: | description: |
This is a set of example for how to create or use This is a set of example for how to create or use CharBuffers in various ways.
CharBuffers in various ways.
Two function types work together to offer flexibility in how you build Two function types work together to offer flexibility in how you build
text images for sampling. text images for sampling.
scenarios:
default: run driver=stdout format=readout
cb_fixed: run driver=stdout format=readout bindings='cycle|cb_fixed'
maze: run driver=stdout format=readout bindings='.*seed.*'
bindings: bindings:
@ -70,5 +72,12 @@ bindings:
# initial image to be varied. Each seed should be thought of as a bank # initial image to be varied. Each seed should be thought of as a bank
# selector. This can be useful to ensure that data is different # selector. This can be useful to ensure that data is different
# across similar fields in a test, for example. # across similar fields in a test, for example.
cb_samples_with_seed: CharBufImage('01 ',100,3,2L) cb_seed1: CharBufImage('╱╲',100,30,1L)
cb_seed2: CharBufImage('╱╲',100,30,2L)
cb_seed3: CharBufImage('╱╲',100,30,3L)
cb_seed4: CharBufImage('╱╲',100,30,4L)
cb_seed5: CharBufImage('╱╲',100,30,5L)
cb_seed6: CharBufImage('╱╲',100,30,6L)
cb_seed7: CharBufImage('╱╲',100,30,7L)
cb_seed8: CharBufImage('╱╲',100,30,8L)