about summary refs log tree commit diff stats
path: root/026assert.cc
blob: 6ab49db21b0ad4403aaf400d284e57ea7b99c218 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
:(scenario assert)
% Hide_warnings = true;
recipe main [
  assert 0:literal, [this is an assert in mu]
]
+warn: this is an assert in mu

:(before "End Primitive Recipe Declarations")
ASSERT,
:(before "End Primitive Recipe Numbers")
Recipe_number["assert"] = ASSERT;
:(before "End Primitive Recipe Implementations")
case ASSERT: {
  trace("run") << "ingredient 0 is " << current_instruction().ingredients[0].name;
  vector<long long int> arg0 = read_memory(current_instruction().ingredients[0]);
  assert(arg0.size() == 1);
  if (arg0[0] == 0)
    raise << current_instruction().ingredients[1].name << '\n';
  break;
}