msv-lab / angelix

Semantic program repair system for C programs
http://angelix.io
MIT License
97 stars 38 forks source link

What should I write in assert.json if the output includes string? #12

Closed yodahaji closed 5 years ago

yodahaji commented 5 years ago

I saw all the example in tests. I find the results of all are numeric. What should I write if the result is not numeric?

mechtaev commented 5 years ago

Hi, sorry for the late reply. Currently, strings are not supported explicitly. Generally, you can just add a loop that iterates over the elements of the string, and outputs each individual character using ANGELIX_OUTPUT. Then, it will be just a list of character/numbers in the assert.json file. However, if your program outputs some fixed strings such as "OK", "FAIL", etc, it is more efficient to assign unique numeric identifiers to those strings, e.g. "OK" -> 0, "FAIL" -> 1, etc, and use these identifiers in ANGELIX_OUTPUT and assert.json.