1
1
mirror of https://github.com/wader/fq.git synced 2024-11-27 06:04:47 +03:00
fq/pkg/interp/testdata/value_object.fqtest

869 lines
24 KiB
Plaintext

$ fq -i -d mp3 . test.mp3
mp3> .headers[0].header.flags | ., tovalue, toactual, tosym, type, length?
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.headers[0].header.flags{}:
0x0| 00 | . | unsynchronisation: false
0x0| 00 | . | extended_header: false
0x0| 00 | . | experimental_indicator: false
0x0| 00 | . | unused: 0
{
"experimental_indicator": false,
"extended_header": false,
"unsynchronisation": false,
"unused": 0
}
null
null
"object"
4
mp3> .headers[0].header.flags[0] | ., type, length?
error: expected an array with index 0 but got: object
mp3> .headers[0].header.flags[-1000] | ., type, length?
error: expected an array with index -2 but got: object
mp3> .headers[0].header.flags[1000] | ., type, length?
error: expected an array with index -1 but got: object
mp3> .headers[0].header.flags[1:3] | ., type, length?
error: expected an array but got: object
mp3> .headers[0].header.flags[0:-1] | ., type, length?
error: expected an array but got: object
mp3> .headers[0].header.flags[-1000:2000] | ., type, length?
error: expected an array but got: object
mp3> .headers[0].header.flags["test"] | ., type, length?
null
"null"
0
mp3> [.headers[0].header.flags[]] | type, length?
"array"
4
mp3> .headers[0].header.flags | keys
[
"unsynchronisation",
"extended_header",
"experimental_indicator",
"unused"
]
mp3> .headers[0].header.flags | has("a")
false
mp3> .headers[0].header.flags | has(0)
error: cannot check whether object has a key: 0
mp3> .headers[0].header.flags | type
"object"
mp3> .headers[0].header.flags | tonumber
error: tonumber cannot be applied to: object
mp3> .headers[0].header.flags | tostring
"{\"experimental_indicator\":false,\"extended_header\":false,\"unsynchronisation\":false,\"unused\":0}"
mp3> .headers[0].header.flags + ""
error: cannot add: object ({"experimental_indicator" ...}) and string ("")
mp3> .headers[0].header.flags + 1
error: cannot add: object ({"experimental_indicator" ...}) and number (1)
mp3> .headers[0].header.flags._start | ., type, length?
40
"number"
40
mp3> .headers[0].header.flags._stop | ., type, length?
48
"number"
48
mp3> .headers[0].header.flags._len | ., type, length?
8
"number"
8
mp3> .headers[0].header.flags._name | ., type, length?
"flags"
"string"
5
mp3> .headers[0].header.flags._actual | ., type, length?
null
"null"
0
mp3> .headers[0].header.flags._sym | ., type, length?
null
"null"
0
mp3> .headers[0].header.flags._description | ., type, length?
null
"null"
0
mp3> .headers[0].header.flags._path | ., type, length?
[
"headers",
0,
"header",
"flags"
]
"array"
4
mp3> .headers[0].header.flags._bits | ., type, length?
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
0x0| 00 | . |.: raw bits 0x5-0x5.7 (1)
"string"
8
mp3> .headers[0].header.flags._bytes | ., type, length?
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
0x0| 00 | . |.: raw bits 0x5-0x5.7 (1)
"string"
1
mp3> .headers[0].header.flags._error | ., type, length?
null
"null"
0
mp3> .headers[0].header.flags._gap | ., type, length?
false
"boolean"
mp3> .headers[0].header.flags.a = 1
{
"footers": [],
"frames": [
{
"audio_data": "\u0000\u0000\u0000\u0000\u0000",
"crc_calculated": "827a",
"header": {
"bitrate": 56000,
"channel_mode": "none",
"channels": "mono",
"copyright": 0,
"emphasis": "none",
"layer": 3,
"mpeg_version": "1",
"original": 0,
"padding": "not_padded",
"private": 0,
"protection_absent": true,
"sample_count": 1152,
"sample_rate": 44100,
"sync": 2047
},
"side_info": {
"granules": [
[
{
"big_values": 0,
"blocksplit_flag": 0,
"count1table_select": 0,
"global_gain": 0,
"part2_3_length": 0,
"preflag": 0,
"region_address1": 0,
"region_address2": 0,
"scalefac_compress": 0,
"scalefac_scale": 0,
"table_select0": 0,
"table_select1": 0,
"table_select2": 0
}
],
[
{
"big_values": 0,
"blocksplit_flag": 0,
"count1table_select": 0,
"global_gain": 0,
"part2_3_length": 0,
"preflag": 0,
"region_address1": 0,
"region_address2": 0,
"scalefac_compress": 0,
"scalefac_scale": 0,
"table_select0": 0,
"table_select1": 0,
"table_select2": 0
}
]
],
"main_data_begin": 0,
"scfsi0": 0,
"share": 0
},
"tag": {
"abr_vbr": 0,
"audiophile_replay_gain": 0,
"bytes": 599,
"encoder": "Lavc58.91",
"encoder_delay": 576,
"encoder_padding": 1287,
"frames": 2,
"header": "Info",
"lame_ath_type": 0,
"lame_flags": 0,
"length": 599,
"lowpass_filter": 0,
"misc": 0,
"mp3_gain": 0,
"music_crc": 25328,
"present_flags": {
"bytes": true,
"frames": true,
"quality": true,
"toc": true,
"unused": 0
},
"preset": 0,
"quality": 0,
"radio_replay_gain": 0,
"replay_gain_peak": 0,
"tag_crc": 23093,
"tag_revision": 0,
"toc": [
0,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255
],
"vbr_method": 0
}
},
{
"audio_data": "\u0007\ufffdÎ3\ufffd\ufffdd\ufffd\ufffd\ufffd\b\u001cX\u001f^\u001f\u0018\u001cF\u0004\u001e\ufffd\ufffd\ufffd.Z\u000f\ufffd;\u0013k\ufffd\ufffd`P\u0014\u0004\u0003\u0002\ufffdD\fNhѣl\u001fx\ufffd\u0010\u000418?\ufffd\u0007Nt\ufffd\ufffd_\ufffdr\ufffd\ufffd\ufffdw.\u000f\ufffd\ufffd\ufffd|\u0010\fJ\u0000\ufffd\ufffd \u0001\ufffd\ufffd\ufffdy\ufffd\ufffdxO\ufffd\u000f)\u0007\\\ufffd7Q`\ufffd\"\ufffdj\ufffd\u001a~\ufffdU3n/\ufffd&\ufffd\ufffd\n$&\u001b=\u0004pT{J\ufffd\u00196\u001e\ufffd&\ufffd\u007f\ufffd\u0014\ufffd\u000b\rb\u007f\ufffd\ufffd\ufffd!F9G\ufffd\t\ufffd*\u001a\n\u0005}\u001e\u0005\u0004H\ufffdg~\ufffd\ufffd\ufffd!\u0013BA/\ufffd\ufffd\ufffdI\ufffdֵ\t\u0004@\ufffd\ufffdJ\ufffd\ufffd\u0011",
"crc_calculated": "e5b0",
"header": {
"bitrate": 64000,
"channel_mode": "none",
"channels": "mono",
"copyright": 0,
"emphasis": "none",
"layer": 3,
"mpeg_version": "1",
"original": 1,
"padding": "not_padded",
"private": 0,
"protection_absent": true,
"sample_count": 1152,
"sample_rate": 44100,
"sync": 2047
},
"side_info": {
"granules": [
[
{
"big_values": 33,
"block_type": "start block",
"blocksplit_flag": 1,
"count1table_select": 0,
"global_gain": 151,
"part2_3_length": 651,
"preflag": 0,
"scalefac_compress": 2,
"scalefac_scale": 0,
"subblock_gain0": 0,
"subblock_gain1": 0,
"subblock_gain2": 0,
"switch_point": 0,
"table_select0": 25,
"table_select1": 9
}
],
[
{
"big_values": 77,
"block_type": "3 short windows",
"blocksplit_flag": 1,
"count1table_select": 0,
"global_gain": 172,
"part2_3_length": 769,
"preflag": 0,
"scalefac_compress": 9,
"scalefac_scale": 0,
"subblock_gain0": 0,
"subblock_gain1": 0,
"subblock_gain2": 0,
"switch_point": 0,
"table_select0": 24,
"table_select1": 8
}
]
],
"main_data_begin": 0,
"scfsi0": 0,
"share": 0
}
},
{
"audio_data": "\u0011K6J\b\ufffdX\ufffd \ufffd)R\ufffd\ufffd\ufffd\ufffd\u0013\ufffd@$\ufffd\ufffd#BPV\r\u0018\u0011\u0003AްU`\ufffdDx\ufffdv\n\ufffd?\ufffdN\ufffdr\ufffd\ufffd5*ugb/\ufffdW\ufffd=Ŀ\ufffd\ufffd\u0012LAME3.100\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd",
"crc_calculated": "61fd",
"header": {
"bitrate": 64000,
"channel_mode": "none",
"channels": "mono",
"copyright": 0,
"emphasis": "none",
"layer": 3,
"mpeg_version": "1",
"original": 1,
"padding": "padded",
"private": 0,
"protection_absent": true,
"sample_count": 1152,
"sample_rate": 44100,
"sync": 2047
},
"side_info": {
"granules": [
[
{
"big_values": 28,
"block_type": "end",
"blocksplit_flag": 1,
"count1table_select": 0,
"global_gain": 148,
"part2_3_length": 581,
"preflag": 0,
"scalefac_compress": 9,
"scalefac_scale": 0,
"subblock_gain0": 0,
"subblock_gain1": 0,
"subblock_gain2": 0,
"switch_point": 0,
"table_select0": 12,
"table_select1": 6
}
],
[
{
"big_values": 0,
"blocksplit_flag": 0,
"count1table_select": 0,
"global_gain": 210,
"part2_3_length": 0,
"preflag": 1,
"region_address1": 0,
"region_address2": 0,
"scalefac_compress": 0,
"scalefac_scale": 0,
"table_select0": 0,
"table_select1": 0,
"table_select2": 0
}
]
],
"main_data_begin": 9,
"scfsi0": 15,
"share": 0
}
}
],
"headers": [
{
"frames": [
{
"flags": {
"compression": false,
"data_length_indicator": false,
"encryption": false,
"file_alter_preservation": false,
"grouping_identity": false,
"read_only": false,
"tag_alter_preservation": false,
"unsync": false,
"unused0": 0,
"unused1": 0,
"unused2": 0
},
"id": "TSSE",
"size": 15,
"text": "Lavf58.45.100",
"text_encoding": "utf8"
}
],
"header": {
"flags": {
"a": 1,
"experimental_indicator": false,
"extended_header": false,
"unsynchronisation": false,
"unused": 0
},
"magic": "ID3",
"revision": 0,
"size": 35,
"version": 4
},
"padding": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
}
]
}
mp3> .headers[0].header.flags[0] = 1
error: expected an array but got: object ({"experimental_indicator" ...})
mp3> .headers[0].header.flags.a |= empty
{
"footers": [],
"frames": [
{
"audio_data": "\u0000\u0000\u0000\u0000\u0000",
"crc_calculated": "827a",
"header": {
"bitrate": 56000,
"channel_mode": "none",
"channels": "mono",
"copyright": 0,
"emphasis": "none",
"layer": 3,
"mpeg_version": "1",
"original": 0,
"padding": "not_padded",
"private": 0,
"protection_absent": true,
"sample_count": 1152,
"sample_rate": 44100,
"sync": 2047
},
"side_info": {
"granules": [
[
{
"big_values": 0,
"blocksplit_flag": 0,
"count1table_select": 0,
"global_gain": 0,
"part2_3_length": 0,
"preflag": 0,
"region_address1": 0,
"region_address2": 0,
"scalefac_compress": 0,
"scalefac_scale": 0,
"table_select0": 0,
"table_select1": 0,
"table_select2": 0
}
],
[
{
"big_values": 0,
"blocksplit_flag": 0,
"count1table_select": 0,
"global_gain": 0,
"part2_3_length": 0,
"preflag": 0,
"region_address1": 0,
"region_address2": 0,
"scalefac_compress": 0,
"scalefac_scale": 0,
"table_select0": 0,
"table_select1": 0,
"table_select2": 0
}
]
],
"main_data_begin": 0,
"scfsi0": 0,
"share": 0
},
"tag": {
"abr_vbr": 0,
"audiophile_replay_gain": 0,
"bytes": 599,
"encoder": "Lavc58.91",
"encoder_delay": 576,
"encoder_padding": 1287,
"frames": 2,
"header": "Info",
"lame_ath_type": 0,
"lame_flags": 0,
"length": 599,
"lowpass_filter": 0,
"misc": 0,
"mp3_gain": 0,
"music_crc": 25328,
"present_flags": {
"bytes": true,
"frames": true,
"quality": true,
"toc": true,
"unused": 0
},
"preset": 0,
"quality": 0,
"radio_replay_gain": 0,
"replay_gain_peak": 0,
"tag_crc": 23093,
"tag_revision": 0,
"toc": [
0,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
166,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255,
255
],
"vbr_method": 0
}
},
{
"audio_data": "\u0007\ufffdÎ3\ufffd\ufffdd\ufffd\ufffd\ufffd\b\u001cX\u001f^\u001f\u0018\u001cF\u0004\u001e\ufffd\ufffd\ufffd.Z\u000f\ufffd;\u0013k\ufffd\ufffd`P\u0014\u0004\u0003\u0002\ufffdD\fNhѣl\u001fx\ufffd\u0010\u000418?\ufffd\u0007Nt\ufffd\ufffd_\ufffdr\ufffd\ufffd\ufffdw.\u000f\ufffd\ufffd\ufffd|\u0010\fJ\u0000\ufffd\ufffd \u0001\ufffd\ufffd\ufffdy\ufffd\ufffdxO\ufffd\u000f)\u0007\\\ufffd7Q`\ufffd\"\ufffdj\ufffd\u001a~\ufffdU3n/\ufffd&\ufffd\ufffd\n$&\u001b=\u0004pT{J\ufffd\u00196\u001e\ufffd&\ufffd\u007f\ufffd\u0014\ufffd\u000b\rb\u007f\ufffd\ufffd\ufffd!F9G\ufffd\t\ufffd*\u001a\n\u0005}\u001e\u0005\u0004H\ufffdg~\ufffd\ufffd\ufffd!\u0013BA/\ufffd\ufffd\ufffdI\ufffdֵ\t\u0004@\ufffd\ufffdJ\ufffd\ufffd\u0011",
"crc_calculated": "e5b0",
"header": {
"bitrate": 64000,
"channel_mode": "none",
"channels": "mono",
"copyright": 0,
"emphasis": "none",
"layer": 3,
"mpeg_version": "1",
"original": 1,
"padding": "not_padded",
"private": 0,
"protection_absent": true,
"sample_count": 1152,
"sample_rate": 44100,
"sync": 2047
},
"side_info": {
"granules": [
[
{
"big_values": 33,
"block_type": "start block",
"blocksplit_flag": 1,
"count1table_select": 0,
"global_gain": 151,
"part2_3_length": 651,
"preflag": 0,
"scalefac_compress": 2,
"scalefac_scale": 0,
"subblock_gain0": 0,
"subblock_gain1": 0,
"subblock_gain2": 0,
"switch_point": 0,
"table_select0": 25,
"table_select1": 9
}
],
[
{
"big_values": 77,
"block_type": "3 short windows",
"blocksplit_flag": 1,
"count1table_select": 0,
"global_gain": 172,
"part2_3_length": 769,
"preflag": 0,
"scalefac_compress": 9,
"scalefac_scale": 0,
"subblock_gain0": 0,
"subblock_gain1": 0,
"subblock_gain2": 0,
"switch_point": 0,
"table_select0": 24,
"table_select1": 8
}
]
],
"main_data_begin": 0,
"scfsi0": 0,
"share": 0
}
},
{
"audio_data": "\u0011K6J\b\ufffdX\ufffd \ufffd)R\ufffd\ufffd\ufffd\ufffd\u0013\ufffd@$\ufffd\ufffd#BPV\r\u0018\u0011\u0003AްU`\ufffdDx\ufffdv\n\ufffd?\ufffdN\ufffdr\ufffd\ufffd5*ugb/\ufffdW\ufffd=Ŀ\ufffd\ufffd\u0012LAME3.100\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd",
"crc_calculated": "61fd",
"header": {
"bitrate": 64000,
"channel_mode": "none",
"channels": "mono",
"copyright": 0,
"emphasis": "none",
"layer": 3,
"mpeg_version": "1",
"original": 1,
"padding": "padded",
"private": 0,
"protection_absent": true,
"sample_count": 1152,
"sample_rate": 44100,
"sync": 2047
},
"side_info": {
"granules": [
[
{
"big_values": 28,
"block_type": "end",
"blocksplit_flag": 1,
"count1table_select": 0,
"global_gain": 148,
"part2_3_length": 581,
"preflag": 0,
"scalefac_compress": 9,
"scalefac_scale": 0,
"subblock_gain0": 0,
"subblock_gain1": 0,
"subblock_gain2": 0,
"switch_point": 0,
"table_select0": 12,
"table_select1": 6
}
],
[
{
"big_values": 0,
"blocksplit_flag": 0,
"count1table_select": 0,
"global_gain": 210,
"part2_3_length": 0,
"preflag": 1,
"region_address1": 0,
"region_address2": 0,
"scalefac_compress": 0,
"scalefac_scale": 0,
"table_select0": 0,
"table_select1": 0,
"table_select2": 0
}
]
],
"main_data_begin": 9,
"scfsi0": 15,
"share": 0
}
}
],
"headers": [
{
"frames": [
{
"flags": {
"compression": false,
"data_length_indicator": false,
"encryption": false,
"file_alter_preservation": false,
"grouping_identity": false,
"read_only": false,
"tag_alter_preservation": false,
"unsync": false,
"unused0": 0,
"unused1": 0,
"unused2": 0
},
"id": "TSSE",
"size": 15,
"text": "Lavf58.45.100",
"text_encoding": "utf8"
}
],
"header": {
"flags": {
"experimental_indicator": false,
"extended_header": false,
"unsynchronisation": false,
"unused": 0
},
"magic": "ID3",
"revision": 0,
"size": 35,
"version": 4
},
"padding": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
}
]
}
mp3> .headers[0].header.flags[0] |= empty
error: expected an array with index 0 but got: object
mp3> .headers[0].header.flags | setpath(["a"]; 1)
{
"a": 1,
"experimental_indicator": false,
"extended_header": false,
"unsynchronisation": false,
"unused": 0
}
mp3> .headers[0].header.flags | setpath([0]; 1)
error: expected an array but got: object ({"experimental_indicator" ...})
mp3> .headers[0].header.flags | delpaths([["a"]])
{
"experimental_indicator": false,
"extended_header": false,
"unsynchronisation": false,
"unused": 0
}
mp3> .headers[0].header.flags | delpaths([[0]])
error: expected an array but got: object ({"experimental_indicator" ...})
mp3> ^D