|
| 1 | +# SPDX-License-Identifier: MIT OR PMPL-1.0-or-later |
| 2 | +# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) |
| 3 | + |
| 4 | +# Anvomidav — Figure Skating Choreography DSL |
| 5 | +# |
| 6 | +# Placeholder test module for the Anvomidav language. |
| 7 | +# Anvomidav is currently in the concept phase (no implementation yet). |
| 8 | +# These tests validate the planned domain model and will grow as the |
| 9 | +# compiler/interpreter is built out. |
| 10 | +# |
| 11 | +# The test file uses ExUnit (Elixir) as a lightweight harness that |
| 12 | +# does not require a full build system during the concept phase. |
| 13 | + |
| 14 | +ExUnit.start() |
| 15 | + |
| 16 | +defmodule Anvomidav.SpecTest do |
| 17 | + @moduledoc """ |
| 18 | + Specification tests for the Anvomidav figure skating DSL. |
| 19 | +
|
| 20 | + These tests encode domain invariants from the ISU (International Skating |
| 21 | + Union) technical rules, ensuring the language design respects real-world |
| 22 | + constraints from day one. |
| 23 | + """ |
| 24 | + use ExUnit.Case, async: true |
| 25 | + |
| 26 | + # ------------------------------------------------------------------ |
| 27 | + # ISU Element Categories |
| 28 | + # ------------------------------------------------------------------ |
| 29 | + |
| 30 | + @isu_jump_types ~w(toe_loop salchow loop flip lutz axel) |
| 31 | + @isu_spin_types ~w(upright sit camel combination) |
| 32 | + @isu_max_jumping_passes_short 3 |
| 33 | + @isu_max_jumping_passes_free 7 |
| 34 | + |
| 35 | + test "ISU jump catalogue contains the six recognised jumps" do |
| 36 | + assert length(@isu_jump_types) == 6 |
| 37 | + assert "axel" in @isu_jump_types |
| 38 | + assert "lutz" in @isu_jump_types |
| 39 | + end |
| 40 | + |
| 41 | + test "ISU spin catalogue contains the four recognised categories" do |
| 42 | + assert length(@isu_spin_types) == 4 |
| 43 | + assert "combination" in @isu_spin_types |
| 44 | + end |
| 45 | + |
| 46 | + test "short programme allows at most 3 jumping passes" do |
| 47 | + programme_jumps = [:toe_loop, :salchow, :axel] |
| 48 | + assert length(programme_jumps) <= @isu_max_jumping_passes_short |
| 49 | + end |
| 50 | + |
| 51 | + test "free programme allows at most 7 jumping passes" do |
| 52 | + programme_jumps = [:lutz, :flip, :loop, :salchow, :toe_loop, :axel, :lutz] |
| 53 | + assert length(programme_jumps) <= @isu_max_jumping_passes_free |
| 54 | + end |
| 55 | + |
| 56 | + test "exceeding maximum jumping passes is detected" do |
| 57 | + programme_jumps = List.duplicate(:axel, 8) |
| 58 | + assert length(programme_jumps) > @isu_max_jumping_passes_free |
| 59 | + end |
| 60 | + |
| 61 | + # ------------------------------------------------------------------ |
| 62 | + # Planned Notation Primitives |
| 63 | + # ------------------------------------------------------------------ |
| 64 | + |
| 65 | + test "element notation is a {type, name, level} triple" do |
| 66 | + element = %{type: :jump, name: :axel, level: 2} |
| 67 | + assert element.type == :jump |
| 68 | + assert element.name == :axel |
| 69 | + assert element.level == 2 |
| 70 | + end |
| 71 | + |
| 72 | + test "sequence is an ordered list of elements" do |
| 73 | + sequence = [ |
| 74 | + %{type: :jump, name: :lutz, level: 3}, |
| 75 | + %{type: :spin, name: :camel, level: 4}, |
| 76 | + %{type: :step, name: :step_sequence, level: 3} |
| 77 | + ] |
| 78 | + assert length(sequence) == 3 |
| 79 | + assert hd(sequence).type == :jump |
| 80 | + end |
| 81 | +end |
0 commit comments