update
This commit is contained in:
@@ -37,8 +37,9 @@ async function test_dict_receive() {
|
||||
}
|
||||
);
|
||||
|
||||
// Result is a list of {dataname, data, type} objects
|
||||
for (const { dataname, data, type } of result) {
|
||||
// Result is an envelope dictionary with payloads field
|
||||
// Access payloads with result.payloads
|
||||
for (const { dataname, data, type } of result.payloads) {
|
||||
if (typeof data === 'object' && data !== null && !Array.isArray(data)) {
|
||||
log_trace(`Received Dictionary '${dataname}' of type ${type}`);
|
||||
|
||||
|
||||
@@ -36,8 +36,9 @@ async function test_large_binary_receive() {
|
||||
}
|
||||
);
|
||||
|
||||
// Result is a list of {dataname, data, type} objects
|
||||
for (const { dataname, data, type } of result) {
|
||||
// Result is an envelope dictionary with payloads field
|
||||
// Access payloads with result.payloads
|
||||
for (const { dataname, data, type } of result.payloads) {
|
||||
if (data instanceof Uint8Array || Array.isArray(data)) {
|
||||
const file_size = data.length;
|
||||
log_trace(`Received ${file_size} bytes of binary data for '${dataname}' of type ${type}`);
|
||||
|
||||
@@ -40,10 +40,11 @@ async function test_mix_receive() {
|
||||
}
|
||||
);
|
||||
|
||||
log_trace(`Received ${result.length} payloads`);
|
||||
log_trace(`Received ${result.payloads.length} payloads`);
|
||||
|
||||
// Result is a list of {dataname, data, type} objects
|
||||
for (const { dataname, data, type } of result) {
|
||||
// Result is an envelope dictionary with payloads field
|
||||
// Access payloads with result.payloads
|
||||
for (const { dataname, data, type } of result.payloads) {
|
||||
log_trace(`\n=== Payload: ${dataname} (type: ${type}) ===`);
|
||||
|
||||
// Handle different data types
|
||||
@@ -122,13 +123,13 @@ async function test_mix_receive() {
|
||||
|
||||
// Summary
|
||||
console.log("\n=== Verification Summary ===");
|
||||
const text_count = result.filter(x => x.type === "text").length;
|
||||
const dict_count = result.filter(x => x.type === "dictionary").length;
|
||||
const table_count = result.filter(x => x.type === "table").length;
|
||||
const image_count = result.filter(x => x.type === "image").length;
|
||||
const audio_count = result.filter(x => x.type === "audio").length;
|
||||
const video_count = result.filter(x => x.type === "video").length;
|
||||
const binary_count = result.filter(x => x.type === "binary").length;
|
||||
const text_count = result.payloads.filter(x => x.type === "text").length;
|
||||
const dict_count = result.payloads.filter(x => x.type === "dictionary").length;
|
||||
const table_count = result.payloads.filter(x => x.type === "table").length;
|
||||
const image_count = result.payloads.filter(x => x.type === "image").length;
|
||||
const audio_count = result.payloads.filter(x => x.type === "audio").length;
|
||||
const video_count = result.payloads.filter(x => x.type === "video").length;
|
||||
const binary_count = result.payloads.filter(x => x.type === "binary").length;
|
||||
|
||||
log_trace(`Text payloads: ${text_count}`);
|
||||
log_trace(`Dictionary payloads: ${dict_count}`);
|
||||
@@ -140,7 +141,7 @@ async function test_mix_receive() {
|
||||
|
||||
// Print transport type info for each payload if available
|
||||
console.log("\n=== Payload Details ===");
|
||||
for (const { dataname, data, type } of result) {
|
||||
for (const { dataname, data, type } of result.payloads) {
|
||||
if (["image", "audio", "video", "binary"].includes(type)) {
|
||||
log_trace(`${dataname}: ${data.length} bytes (binary)`);
|
||||
} else if (type === "table") {
|
||||
|
||||
@@ -40,8 +40,9 @@ async function test_table_receive() {
|
||||
}
|
||||
);
|
||||
|
||||
// Result is a list of {dataname, data, type} objects
|
||||
for (const { dataname, data, type } of result) {
|
||||
// Result is an envelope dictionary with payloads field
|
||||
// Access payloads with result.payloads
|
||||
for (const { dataname, data, type } of result.payloads) {
|
||||
if (Array.isArray(data)) {
|
||||
log_trace(`Received Table '${dataname}' of type ${type}`);
|
||||
|
||||
|
||||
@@ -37,8 +37,9 @@ async function test_text_receive() {
|
||||
}
|
||||
);
|
||||
|
||||
// Result is a list of {dataname, data, type} objects
|
||||
for (const { dataname, data, type } of result) {
|
||||
// Result is an envelope dictionary with payloads field
|
||||
// Access payloads with result.payloads
|
||||
for (const { dataname, data, type } of result.payloads) {
|
||||
if (typeof data === 'string') {
|
||||
log_trace(`Received text '${dataname}' of type ${type}`);
|
||||
log_trace(` Length: ${data.length} characters`);
|
||||
|
||||
@@ -42,8 +42,8 @@ function test_dict_receive()
|
||||
max_delay = 5000
|
||||
)
|
||||
|
||||
# Result is a list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result
|
||||
# Result is an envelope dictionary with payloads field containing list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result["payloads"]
|
||||
if isa(data, JSON.Object{String, Any})
|
||||
log_trace("Received Dictionary '$dataname' of type $data_type")
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ function test_large_binary_receive()
|
||||
max_delay = 5000
|
||||
)
|
||||
|
||||
# Result is a list of (dataname, data) tuples
|
||||
for (dataname, data, data_type) in result
|
||||
# Result is an envelope dictionary with payloads field containing list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result["payloads"]
|
||||
# Check transport type from the envelope
|
||||
# For link transport, data is the URL string
|
||||
# For direct transport, data is the actual payload bytes
|
||||
|
||||
@@ -45,10 +45,10 @@ function test_mix_receive()
|
||||
max_delay = 5000
|
||||
)
|
||||
|
||||
log_trace("Received $(length(result)) payloads")
|
||||
log_trace("Received $(length(result["payloads"])) payloads")
|
||||
|
||||
# Result is a list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result
|
||||
# Result is an envelope dictionary with payloads field containing list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result["payloads"]
|
||||
log_trace("\n=== Payload: $dataname (type: $data_type) ===")
|
||||
|
||||
# Handle different data types
|
||||
@@ -178,13 +178,13 @@ function test_mix_receive()
|
||||
|
||||
# Summary
|
||||
println("\n=== Verification Summary ===")
|
||||
text_count = count(x -> x[3] == "text", result)
|
||||
dict_count = count(x -> x[3] == "dictionary", result)
|
||||
table_count = count(x -> x[3] == "table", result)
|
||||
image_count = count(x -> x[3] == "image", result)
|
||||
audio_count = count(x -> x[3] == "audio", result)
|
||||
video_count = count(x -> x[3] == "video", result)
|
||||
binary_count = count(x -> x[3] == "binary", result)
|
||||
text_count = count(x -> x[3] == "text", result["payloads"])
|
||||
dict_count = count(x -> x[3] == "dictionary", result["payloads"])
|
||||
table_count = count(x -> x[3] == "table", result["payloads"])
|
||||
image_count = count(x -> x[3] == "image", result["payloads"])
|
||||
audio_count = count(x -> x[3] == "audio", result["payloads"])
|
||||
video_count = count(x -> x[3] == "video", result["payloads"])
|
||||
binary_count = count(x -> x[3] == "binary", result["payloads"])
|
||||
|
||||
log_trace("Text payloads: $text_count")
|
||||
log_trace("Dictionary payloads: $dict_count")
|
||||
@@ -196,7 +196,7 @@ function test_mix_receive()
|
||||
|
||||
# Print transport type info for each payload if available
|
||||
println("\n=== Payload Details ===")
|
||||
for (dataname, data, data_type) in result
|
||||
for (dataname, data, data_type) in result["payloads"]
|
||||
if data_type in ["image", "audio", "video", "binary"]
|
||||
log_trace("$dataname: $(length(data)) bytes (binary)")
|
||||
elseif data_type == "table"
|
||||
|
||||
@@ -42,8 +42,8 @@ function test_table_receive()
|
||||
max_delay = 5000
|
||||
)
|
||||
|
||||
# Result is a list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result
|
||||
# Result is an envelope dictionary with payloads field containing list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result["payloads"]
|
||||
data = DataFrame(data)
|
||||
if isa(data, DataFrame)
|
||||
log_trace("Received DataFrame '$dataname' of type $data_type")
|
||||
|
||||
@@ -42,8 +42,8 @@ function test_text_receive()
|
||||
max_delay = 5000
|
||||
)
|
||||
|
||||
# Result is a list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result
|
||||
# Result is an envelope dictionary with payloads field containing list of (dataname, data, data_type) tuples
|
||||
for (dataname, data, data_type) in result["payloads"]
|
||||
if isa(data, String)
|
||||
log_trace("Received text '$dataname' of type $data_type")
|
||||
log_trace(" Length: $(length(data)) characters")
|
||||
|
||||
@@ -36,8 +36,8 @@ def test_text_message():
|
||||
print(" Payloads: {}".format(len(env.payloads)))
|
||||
|
||||
# Expected output on receiver:
|
||||
# payloads = smartreceive(msg)
|
||||
# for dataname, data, type in payloads:
|
||||
# envelope = smartreceive(msg)
|
||||
# for dataname, data, type in envelope["payloads"]:
|
||||
# print("Received {}: {}".format(dataname, data))
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ def test_dictionary_message():
|
||||
print(" Payloads: {}".format(len(env.payloads)))
|
||||
|
||||
# Expected output on receiver:
|
||||
# payloads = smartreceive(msg)
|
||||
# for dataname, data, type in payloads:
|
||||
# envelope = smartreceive(msg)
|
||||
# for dataname, data, type in envelope["payloads"]:
|
||||
# if type == "dictionary":
|
||||
# print("Config: {}".format(data))
|
||||
|
||||
@@ -99,8 +99,8 @@ def test_mixed_payloads():
|
||||
print(" Payloads: {}".format(len(env.payloads)))
|
||||
|
||||
# Expected output on receiver:
|
||||
# payloads = smartreceive(msg)
|
||||
# for dataname, data, type in payloads:
|
||||
# envelope = smartreceive(msg)
|
||||
# for dataname, data, type in envelope["payloads"]:
|
||||
# print("Received {}: {} (type: {})".format(dataname, data if type != "binary" else len(data), type))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user