interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / tests / turing / test_ty_energy_fixtures.sh

48 lines · 1918 bytes Raw Blame History
1#!/bin/sh
2# SPDX-License-Identifier: Apache-2.0
3# Copyright 2026 Drake Stapleton (AIEN / aien-dev)
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Synthetic input checks. These fixtures cannot qualify hardware measurement.
18set -eu
19RED=$1
20OUT=$2
21GEN=$3
22mkdir -p "$OUT"
23case_run() {
24 name=$1; fault=$2; expected=$3
25 dir=$OUT/$name
26 mkdir -p "$dir"
27 "$GEN" IDLE 0 none > "$dir/00-idle.jsonl"
28 "$GEN" A 2000000000 none > "$dir/01-a.jsonl"
29 "$GEN" B 4000000000 none > "$dir/02-b.jsonl"
30 "$GEN" AB 6000000000 "$fault" > "$dir/03-ab.jsonl"
31 "$RED" --check "$dir" > "$dir/result.txt"
32 grep -q "$expected" "$dir/result.txt"
33}
34case_run valid none 'ROUND S1 r1 OK'
35case_run sensor sensor SENSOR_UNAVAILABLE
36case_run wrap wrap COUNTER_WRAP
37case_run overflow overflow COUNTER_WRAP
38case_run oracle oracle PARTIAL_RUN
39case_run multiplexed multiplexed PMU_MULTIPLEXED
40mkdir -p "$OUT/missing-edge"
41printf '%s\n' '{"run":"bad","config":"S1","level":"AB","tool_cpu":0}' > "$OUT/missing-edge/bad.jsonl"
42"$RED" --check "$OUT/missing-edge" > "$OUT/missing-edge/result.txt"
43grep -q BAD_ARGUMENT "$OUT/missing-edge/result.txt"
44mkdir -p "$OUT/empty" "$OUT/malformed"
45printf '%s\n' '[]' > "$OUT/malformed/bad.jsonl"
46if "$RED" --check "$OUT/empty" >/dev/null 2>&1; then exit 1; fi
47if "$RED" --check "$OUT/malformed" >/dev/null 2>&1; then exit 1; fi
48printf '%s\n' 'ty_energy fixtures: nine valid/refusal cases passed'