أكد
Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.
Asserts that a condition is true at runtime.
Aliases: assert
Syntax: أكد <expression> [انهر <expression>]
Category#
testing
Related#
Examples#
radix/corpus/adfirma/adfirma.fab (canonical · keyword)#
Asserts that a condition is true at runtime.
test "assertions validate invariants" {
const int x ← 10
assert x ≻ 0
assert x ≡ 10 panic "x decem esse debet"
const string اسم ← "Marcus"
assert اسم ≡ "Marcus"
assert اسم ≠ "" panic "nomen vacuum non sit"
const bool viget ← true
assert viget
assert viget ≡ true panic "vigere debet"
}
# =============================================================================
# أكد — Asserts that a condition is true at runtime.
# =============================================================================
#
# What this teaches:
# • Runtime assertions — `أكد <condition>` validates invariants during
# program execution
# • Custom messages — `أكد <condition> انهر "message"` adds descriptive
# diagnostic text on failure
# • Testing category — أكد is the primary assertion keyword for test
# and verification code
#
# Common mistakes:
# • using `أكد` outside `اختبر` or `مختبر` (WARN006); use `انهر` for invariant violations in production code or move assertions into test blocks
#
# See also: اختبر, افعل, التقط
# =============================================================================
# أكد — runtime assertions
#
# أكد <condition>
# أكد <condition> انهر "nuntius"
#
# GRAMMAR:
# adfirmaStmt :← 'أكد' expr ('انهر' expr)?
#
# EXPECTED OUTPUT:
# empty — أكد only (adfirma.expected)
main {
const int x ← 10
# Simple assertion without message
assert x ≻ 0
# Assertion with custom message
assert x ≡ 10 panic "x decem esse debet"
# Multiple assertions
const string اسم ← "Marcus"
assert اسم ≡ "Marcus"
assert اسم ≠ "" panic "nomen vacuum non sit"
# Boolean assertions
const bool viget ← true
assert viget
assert viget ≡ true panic "vigere debet"
}