bmw-software-engineering / trlc

Treat Requirements Like Code
GNU General Public License v3.0
55 stars 9 forks source link

new structure for checks #86

Open florianschanda opened 3 months ago

florianschanda commented 3 months ago

Having written several complex checks, its clear to me that the existing format is too simple, quickly resulting in repeated constructs.

I suggest a new form:

type T {

  a Integer
  b Integer
  c String
  d Integer [1 .. *]

  begin checks

    if a > b then
       assert c == "gt", "blah"
    elif a < b then
       assert c == "lt", "blah"
    else
       assert c == "eq", "blah"
    end if

    let tmp = a + b

    forall item in d loop
       assert d >= tmp, "blah"
        end loop

  end checks

}

For a more detailed proposal see https://github.com/florianschanda/trlc/blob/main/language-reference-manual/proposal-checks.md