mirror of
https://github.com/FlipsideCrypto/livequery-base.git
synced 2026-02-06 11:16:44 +00:00
269 lines
9.5 KiB
YAML
269 lines
9.5 KiB
YAML
version: 2
|
|
models:
|
|
- name: utils
|
|
columns:
|
|
- name: udf_json_rpc_call
|
|
tests:
|
|
- test_udf:
|
|
name: test__utils_udf_json_rpc_call
|
|
args: "'foo', [], 1"
|
|
assertions:
|
|
- >
|
|
result = {
|
|
'jsonrpc': '2.0',
|
|
'method': 'foo',
|
|
'params': [],
|
|
'id': '1'
|
|
}
|
|
- name: udf_urlencode
|
|
tests:
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_true_1
|
|
args: >
|
|
{'a':'b'}, TRUE
|
|
assertions:
|
|
- result = 'a=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_true_2
|
|
args: >
|
|
{'a':'a', 'b':'b'}, TRUE
|
|
assertions:
|
|
- result = 'a=a&b=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_true_space
|
|
args: >
|
|
{'space': 'abc 123'}, TRUE
|
|
assertions:
|
|
- result = 'space=abc+123'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_true_special
|
|
args: >
|
|
{'special!': ' !@#$,+"'}, TRUE
|
|
assertions:
|
|
- result = 'special%21=+%21%40%23%24%2C%2B%22'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_true_array
|
|
args: >
|
|
{'array': [0, 1, 2]}, TRUE
|
|
assertions:
|
|
- result = 'array=0&array=1&array=2'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_false_1
|
|
args: >
|
|
{'a':'b'}, FALSE
|
|
assertions:
|
|
- result = 'a=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_false_2
|
|
args: >
|
|
{'a':'b', 'b':'b'}, FALSE
|
|
assertions:
|
|
- result = 'a=b&b=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_false_space
|
|
args: >
|
|
{'space': 'abc 123'}, FALSE
|
|
assertions:
|
|
- result = 'space=abc+123'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_false_special
|
|
args: >
|
|
{'special!': ' !@#$,+"'}, FALSE
|
|
assertions:
|
|
- result = 'special%21=+%21%40%23%24%2C%2B%22'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_false_array
|
|
args: >
|
|
{'array': [0, 1, 2]}, FALSE
|
|
assertions:
|
|
- result = 'array=%5B0%2C+1%2C+2%5D'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_1
|
|
args: >
|
|
{'a':'b'}
|
|
assertions:
|
|
- result = 'a=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_2
|
|
args: >
|
|
{'a':'b', 'b':'b'}
|
|
assertions:
|
|
- result = 'a=b&b=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_space
|
|
args: >
|
|
{'space': 'abc 123'}
|
|
assertions:
|
|
- result = 'space=abc+123'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_special
|
|
args: >
|
|
{'special!': ' !@#$,+"'}
|
|
assertions:
|
|
- result = 'special%21=+%21%40%23%24%2C%2B%22'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_dict_array
|
|
args: >
|
|
{'array': [0, 1, 2]}
|
|
assertions:
|
|
- result = 'array=%5B0%2C+1%2C+2%5D'
|
|
# write tests but use arrays of arrays instead of dictionaries
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_true_1
|
|
args: >
|
|
[['a', 'b']], TRUE
|
|
assertions:
|
|
- result = 'a=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_true_2
|
|
args: >
|
|
[['a', 'a'], ['b', 'b']], TRUE
|
|
assertions:
|
|
- result = 'a=a&b=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_true_space
|
|
args: >
|
|
[['space', 'abc 123']], TRUE
|
|
assertions:
|
|
- result = 'space=abc+123'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_true_special
|
|
args: >
|
|
[['special!', ' !@#$,+"']], TRUE
|
|
assertions:
|
|
- result = 'special%21=+%21%40%23%24%2C%2B%22'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_true_array
|
|
args: >
|
|
[['array', [0, 1, 2]]], TRUE
|
|
assertions:
|
|
- result = 'array=0&array=1&array=2'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_false_1
|
|
args: >
|
|
[['a', 'b']], FALSE
|
|
assertions:
|
|
- result = 'a=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_false_2
|
|
args: >
|
|
[['a', 'a'], ['b', 'b']], FALSE
|
|
assertions:
|
|
- result = 'a=a&b=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_false_space
|
|
args: >
|
|
[['space', 'abc 123']], FALSE
|
|
assertions:
|
|
- result = 'space=abc+123'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_false_special
|
|
args: >
|
|
[['special!', ' !@#$,+"']], FALSE
|
|
assertions:
|
|
- result = 'special%21=+%21%40%23%24%2C%2B%22'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_false_array
|
|
args: >
|
|
[['array', [0, 1, 2]]], FALSE
|
|
assertions:
|
|
- result = 'array=%5B0%2C+1%2C+2%5D'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_1
|
|
args: >
|
|
[['a', 'b']]
|
|
assertions:
|
|
- result = 'a=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_2
|
|
args: >
|
|
[['a', 'a'], ['b', 'b']]
|
|
assertions:
|
|
- result = 'a=a&b=b'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_space
|
|
args: >
|
|
[['space', 'abc 123']]
|
|
assertions:
|
|
- result = 'space=abc+123'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_special
|
|
args: >
|
|
[['special!', ' !@#$,+"']]
|
|
assertions:
|
|
- result = 'special%21=+%21%40%23%24%2C%2B%22'
|
|
- test_udf:
|
|
name: test__utils_udf_urlencode_array_array
|
|
args: >
|
|
[['array', [0, 1, 2]]]
|
|
assertions:
|
|
- result = 'array=%5B0%2C+1%2C+2%5D'
|
|
- name: udf_int_to_binary
|
|
tests:
|
|
- test_udf:
|
|
name: test__utils_udf_int_to_binary
|
|
args: 123456789
|
|
assertions:
|
|
- result = '111010110111100110100010101'
|
|
- name: udf_int_to_binary
|
|
tests:
|
|
- test_udf:
|
|
name: test__utils_udf_int_to_binary_large_number
|
|
args: "'123456789123456789123456789123456789123456789'"
|
|
assertions:
|
|
- result = '101100010010011011011100101001111010001001110011010111111101111101010111011001001101000001111110001010100001011011010000100000001000101111100010101'
|
|
- name: udf_binary_to_int
|
|
tests:
|
|
- test_udf:
|
|
name: test__utils_udf_binary_to_int
|
|
args: '111010110111100110100010101'
|
|
assertions:
|
|
- result = '123456789'
|
|
- name: udf_binary_to_int
|
|
tests:
|
|
- test_udf:
|
|
name: test__utils_udf_binary_to_int_large_number
|
|
args: "'110110110100110110100101110101100110100000101111100010101'"
|
|
assertions:
|
|
- result = '123456789123456789'
|
|
- name: udf_evm_decode_log
|
|
tests:
|
|
- test_udf:
|
|
name: test__utils_udf_evm_decode_log
|
|
args: >
|
|
{
|
|
'anonymous': false,
|
|
'inputs': [
|
|
{
|
|
'indexed': false,
|
|
'name': 'nonce',
|
|
'type': 'uint256'
|
|
}
|
|
],
|
|
'name': 'NonceChanged',
|
|
'type': 'event'
|
|
}::variant,
|
|
{
|
|
'address': '0x55032650b14df07b85bf18a3a3ec8e0af2e028d5',
|
|
'data': '0x000000000000000000000000000000000000000000000000000000000000279c',
|
|
'topics': [
|
|
'0x7220970e1f1f12864ecccd8942690a837c7a8dd45d158cb891eb45a8a69134aa'
|
|
]
|
|
}::variant
|
|
assertions:
|
|
- >
|
|
result = [
|
|
{
|
|
'address': '0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5',
|
|
'data': [
|
|
{
|
|
'decoded': true,
|
|
'name': 'nonce',
|
|
'type': 'uint256',
|
|
'value': 10140
|
|
}
|
|
],
|
|
'decoded': true,
|
|
'name': 'NonceChanged'
|
|
}
|
|
] |