-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
🧪 Testing 🧪 #36
Comments
We have some tests that run on pull request. We plan to add more. We also use |
Yes, but.. if I write
how do I test it without converting it to another language? perhaps to do something like:
|
Codewars training hey ? You will have to ask @BaseMax what he thinks |
Actually having a testing framework is all you pre-require to get it included inside Codewars, for your consideration |
Hi Ruslan; We are happy you to join our team and be with us. It will be great if you accept our invite to join this org even if you do not have the opportunity to work, you can advise us.
It was a very good offer. Best; |
Dear ismael suggest a c library for unit testing. |
Hello friends, if we agree with using this framework I have a few points to discuss: |
Thank you Kotbi. @abdorah Yes, it's a good library, which I have no problem with. These are the files that I think need to be tested:
In the lexical stage we will have a series of test texts that we have to have in front of a presentation of tokens. (token types array) |
Now I see your fork. It's good, you moved the test file to another directory. 👍 arg-test is also a good idea. If you have done this. please send your PR. It's welcome. @abdorah |
Thank you @BaseMax ! #include "unity.h"
#include "error.h"
#include "lexer.h"
char *filename;
char *input;
ErrorsContainer *errors;
Lexer *lex;
void setUp(void)
{
//This is the initialization for the variables needed for the unit testing.
filename = "tests/1-hello-world.et";
input = "";
ErrorsInit(errors);
lex = lexerInit(filename, input, errors);
}
void tearDown(void)
{
lexerFree(lex);
}
void test_function_should_check_lex(void)
{
TEST_ASSERT_EQUAL_INT(EXIT_SUCCESS, lexerCheck(lex, errors));
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_function_should_check_lex);
return UNITY_END();
} This can be improved (especially the variables I used). |
Thank you. Send your PR when it's ready.
…On Sun, Jun 6, 2021, 6:31 AM Kotbi Abderrahmane ***@***.***> wrote:
Thank you @BaseMax <https://github.com/BaseMax> !
I took into consideration the files that you said that they need tests. I
started with lexer.test.c . Also, I omitted the file arg-test because I
think that we can leave it to the end (We can use it to make something
similar to an integration test, what do you think?).
This is what I did so far:
https://github.com/abdorah/One/blob/master/unit-tests/
It is basically something like this:
#include "unity.h"
#include "error.h"
#include "lexer.h"
char *filename;char *input;
ErrorsContainer *errors;
Lexer *lex;
void setUp(void)
{
//This is the initialization for the variables needed for the unit testing.
filename = "tests/1-hello-world.et";
input = "";
ErrorsInit(errors);
lex = lexerInit(filename, input, errors);
}
void tearDown(void)
{
lexerFree(lex);
}
void test_function_should_check_lex(void)
{
TEST_ASSERT_EQUAL_INT(EXIT_SUCCESS, lexerCheck(lex, errors));
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_function_should_check_lex);
return UNITY_END();
}
This can be improved (especially the variables I used).
Thank you for your review.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#36 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUI56DRFCZFVEME24DWFPDTRLJHLANCNFSM45P4WMNQ>
.
|
How can you test the code?
The text was updated successfully, but these errors were encountered: