-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing tests #2
Comments
I don't think I handle overflowing file positions very well, especially that it might be hard to test without putting resource pressure on the testing environment. (Also, I thought about allowing any position the platform's
The buffer is dynamically-allocated; overflow should not be possible, only memory exhaustion. I remember attempting to create a test case for that, but I found it difficult to actually trigger memory exhaustion without the executed opcodes/backward branches limits clocking out first. I might need to establish additional upper limits on buffer length/stack depth anyway.
Actually, attempting to print an ASCII NUL makes the command-line front-end trigger a fatal error:
This is because I wanted to prevent rogue patch scripts from reprogramming the user's terminal with control characters. Strictly speaking, this is in violation of the spec (which seems to encourage filtering characters out instead), but I didn't think it was worth it: the terminal output code is already quite complicated, and why would you ever want to legitimately print out control characters to the terminal anyway? (Colour output, I guess. But the spec doesn't mandate supporting ANSI escapes, nor does it offer any way to check if they are available/will be cleanly filtered out, so it won't be portable between different BSP implementations. Or, in fact, a single implementation running on different terminals.) |
Regarding the last point, the spec mandates accepting control characters, not printing them; it only requires a subset of printable ASCII to actually be printable. An implementation that accepts control characters in strings but refuses to print them (or only prints newlines) is compliant.
|
That paragraph doesn't specify if aborting the script upon encountering an unsupported character is acceptable. The previous one only allows it in the case of attempting to print invalid UTF-8. But given that the actual contents of the buffer cannot possibly influence further execution (beyond raising a fatal error, as discussed), there seems to be little point in testing this. And tangentially, strictly speaking the spec suggests that (potential) fatal errors due to bad encoding should only be raised upon an attempt to print the string, not when putting it in the buffer. So this:
should exit cleanly. But both my implementation and yours generate a fatal error. |
Interesting. I'll have to amend the specification, if anything to allow that behavior (as it seems silly to require that example to work). |
I actually made a pull on my own repo regarding this: aaaaaa123456789/bsp#1 Opinions are appreciated. |
Are bit shifts with overly long counts tested? I mean something like this:
The result should be |
While I don't have any reason to suspect the instructions are executing incorrectly, the following cases are not tested at all:
0x80000001
)#0
and#1
bufchar 0
followed by another bufchar/bufstring/bufnumber (the null character must not cause the rest of the output to be suppressed)I'll comment if I find any others missing.
The text was updated successfully, but these errors were encountered: