-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add bunch of test cases #183
Conversation
kant2002
commented
Aug 8, 2022
- Add both working, and not yet working snippets of C
- Add support for recursive dir traversal in integration testing. Will need this for more tests to C runtime
At least 1 test should be removed after #185 lands, since I have basically duplicate test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'm not merging this until everything's green. Have you investigated the reason for the test failures? Do you need help?
Cesium.Compiler/stdlib/stdio.h
Outdated
void printf(char* s) { | ||
// That's temporary until varargs would not be implemented. | ||
// no formatting obviously. | ||
puts(s); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it is valid for stdio.h
to define the function body in a header file.
Also, this deserves a TODO comment (I'm creating an issue for each merged TODO
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. that PR is kitchen sink of different failed attempts to find some place where I can have quick win. I will try to cleanup it which is quite possible, but still it reply on earlier RPs which I send, so I waiting for them to land. I will let you know when this would be ready for your attention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For such cases, you may consider marking a PR as a "draft". This way, you formally let me know that it is not yet ready to merge.
An example of a draft PR is #139.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was lazy when I create it, but cannot convert PR to draft after creation. Maybe that's some permission issue, or require some setup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure what the rules about drafts are, but I've found that I can convert it myself. So I did.
Let me know if you want to un-draft this, and cannot do it yourself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your opinion on this printf
implementation? Should we still merge it being in a header file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to have Cesium.Runtime
to be something minimal and provide as much implementation in C as possible. Example of functions which maybe written in C is atoi
/ioa
, we almost at the point where we can write them in C. Maybe that's require have something like stdlib.c
which would be added automatically by compiler. That's just example, not something which I think though.
For marketing reasons, I think we should have printf
even with limitation as serious as it is right now. Technically right now we don't have "Hello World".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My whole point is that in C, you cannot write code in headers.
If we want to write C stdlib (how do you distinguish it from Cesium.Runtime
, by the way?), then we'll have to do it in .c
files, and link them somehow with the user's program.
For now, this is too much. Let's migrate this to the Cesium.Runtime
, and create a separate issue to discuss details of implementation parts of the standard library in C.
public static int Abs(int value) | ||
{ | ||
if (value == int.MinValue) return int.MinValue; | ||
return Math.Abs(value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow that's a gimmick. Let's write a unit test for the standard library, then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can, but I mostly think that should do that as part of "acceptance testing", but in retrospection after I think a bit on this I do agree with you. That's subsystem should be tested.
Abs is parsing INT_MIN. Fixed. |
Ooh, abs is also requires nested |
38ce4dd
to
f2093e0
Compare
Now it's waiting for #189 only |
f2093e0
to
a79cb4c
Compare
- Add both working, and not yet working snippets of C - Add support for recursive dir traversal in integration testing. Will need this for more tests to C runtime
a79cb4c
to
c7ceafc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!