amduat/tests/asl/test_asl_store_indexed_ops.c

49 lines
1.4 KiB
C
Raw Normal View History

2026-01-17 12:44:33 +01:00
#include "amduat/asl/store.h"
#include "amduat/enc/asl1_core.h"
#include "amduat/hash/asl1.h"
#include <stdio.h>
static int test_indexed_ops_unsupported(void) {
amduat_asl_store_ops_t ops;
amduat_asl_store_config_t config;
amduat_asl_store_t store;
amduat_asl_store_error_t err;
amduat_asl_index_state_t state;
amduat_artifact_t artifact;
amduat_reference_t ref;
amduat_asl_store_ops_init(&ops);
config.encoding_profile_id = AMDUAT_ENC_ASL1_CORE_V1;
config.hash_id = AMDUAT_HASH_ASL1_ID_SHA256;
amduat_asl_store_init(&store, config, ops, NULL);
artifact = amduat_artifact(amduat_octets(NULL, 0u));
ref = amduat_reference(0u, amduat_octets(NULL, 0u));
state.snapshot_id = 0u;
state.log_position = 0u;
err = amduat_asl_store_put_indexed(&store, artifact, &ref, &state);
if (err != AMDUAT_ASL_STORE_ERR_UNSUPPORTED) {
fprintf(stderr, "put_indexed missing ops should be unsupported: %d\n", err);
return 1;
}
err = amduat_asl_store_get_indexed(&store, ref, state, &artifact);
if (err != AMDUAT_ASL_STORE_ERR_UNSUPPORTED) {
fprintf(stderr, "get_indexed missing ops should be unsupported: %d\n", err);
return 1;
}
if (amduat_asl_index_current_state(&store, &state)) {
fprintf(stderr, "current_state missing ops should be false\n");
return 1;
}
return 0;
}
int main(void) {
return test_indexed_ops_unsupported();
}