| #include <stdio.h> |
| #include "cuneiform_u_v3.h" |
|
|
| int run_test() { |
| printf("======================================================================\n"); |
| printf(" CUNEIFORM-U V3.0 / LANGUAGE U V4.0 C-BASED RANGE CODER BENCHMARK\n"); |
| printf(" zymatica.space | astronautshe.com\n"); |
| printf("======================================================================\n\n"); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| Concept6D reboot_sequence[40]; |
| Concept6D block[4] = { |
| {8, 0, 0, 4, 7, 8}, |
| {0, 0, 15, 14, 5, 1}, |
| {0, 0, 7, 11, 13, 15}, |
| {0, 0, 7, 14, 0, 11} |
| }; |
| for (int i = 0; i < 10; i++) { |
| memcpy(&reboot_sequence[i * 4], block, sizeof(block)); |
| } |
|
|
| uint8_t compressed_buf[256]; |
| uint32_t max_bytes = sizeof(compressed_buf); |
|
|
| |
| int bit_count = cuneiform_u_v3_encode(reboot_sequence, 40, compressed_buf, max_bytes, 1, 128); |
| if (bit_count < 0) { |
| printf("Encoding failed!\n"); |
| return 1; |
| } |
| int byte_count = (bit_count + 7) / 8; |
|
|
| printf("--- BENCHMARK 1: REBOOT SEQUENCE (40 Concepts) ---\n"); |
| printf(" Cuneiform-U v3.0 C-Coder size: %d bytes (%d bits)\n", byte_count, bit_count); |
| printf(" Semantic bits/concept: %.2f bits\n", (float)bit_count / 40.0f); |
|
|
| |
| Concept6D decoded_sequence[40]; |
| int decode_success = cuneiform_u_v3_decode(compressed_buf, byte_count, decoded_sequence, 40, 1, 128); |
| |
| int match = 1; |
| for (int i = 0; i < 40; i++) { |
| if (reboot_sequence[i].domain != decoded_sequence[i].domain || |
| reboot_sequence[i].subdomain != decoded_sequence[i].subdomain || |
| reboot_sequence[i].operation != decoded_sequence[i].operation || |
| reboot_sequence[i].modality != decoded_sequence[i].modality || |
| reboot_sequence[i].depth != decoded_sequence[i].depth || |
| reboot_sequence[i].polarity != decoded_sequence[i].polarity) { |
| match = 0; |
| printf(" Mismatch at index %d!\n", i); |
| break; |
| } |
| } |
| printf(" Fidelity verification: %s\n\n", match && decode_success ? "PASS ✅" : "FAIL ❌"); |
|
|
| |
| Concept6D dynamic_block[2] = { |
| {1, 3, 3, 13, 4, 6}, |
| {1, 1, 0, 6, 5, 5} |
| }; |
| Concept6D dynamic_sequence[20]; |
| for (int i = 0; i < 10; i++) { |
| memcpy(&dynamic_sequence[i * 2], dynamic_block, sizeof(dynamic_block)); |
| } |
|
|
| bit_count = cuneiform_u_v3_encode(dynamic_sequence, 20, compressed_buf, max_bytes, 1, 128); |
| byte_count = (bit_count + 7) / 8; |
|
|
| printf("--- BENCHMARK 2: ZERO-SHOT DYNAMIC SEMANTIC EXPRESSION (20 Concepts) ---\n"); |
| printf(" Cuneiform-U v3.0 C-Coder size: %d bytes (%d bits)\n", byte_count, bit_count); |
| printf(" Semantic bits/concept: %.2f bits\n", (float)bit_count / 20.0f); |
|
|
| Concept6D decoded_dynamic[20]; |
| decode_success = cuneiform_u_v3_decode(compressed_buf, byte_count, decoded_dynamic, 20, 1, 128); |
|
|
| match = 1; |
| for (int i = 0; i < 20; i++) { |
| if (dynamic_sequence[i].domain != decoded_dynamic[i].domain || |
| dynamic_sequence[i].subdomain != decoded_dynamic[i].subdomain || |
| dynamic_sequence[i].operation != decoded_dynamic[i].operation || |
| dynamic_sequence[i].modality != decoded_dynamic[i].modality || |
| dynamic_sequence[i].depth != decoded_dynamic[i].depth || |
| dynamic_sequence[i].polarity != decoded_dynamic[i].polarity) { |
| match = 0; |
| printf(" Mismatch at index %d!\n", i); |
| break; |
| } |
| } |
| printf(" Fidelity verification: %s\n", match && decode_success ? "PASS ✅" : "FAIL ❌"); |
|
|
| return 0; |
| } |
|
|
| int main() { |
| return run_test(); |
| } |
|
|