Comments (11)
Actually having a testing framework is all you pre-require to get it included inside Codewars, for your consideration
from one.
Dear ismael suggest a c library for unit testing.
https://github.com/ThrowTheSwitch/Unity
cc #55
from one.
Yes, but.. if I write
main {
ret 0
}
how do I test it without converting it to another language?
Do you have any One-Language-based testing framework?
perhaps to do something like:
assertToBe(main, 0,"expected return value to be 0")
from one.
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.
perhaps to do something like:
assertToBe(main, 0,"expected return value to be 0")
It was a very good offer.
Best;
from one.
Hello friends, if we agree with using this framework I have a few points to discuss:
1- https://github.com/ThrowTheSwitch/Unity/blob/master/docs/UnityGettingStartedGuide.md here is a good place to start learning about it.
2- @BaseMax does using unity require any changes on the code structure?
3- what do you think guys from this attempt to use unity?
4- In terms of what should we test first; I think that we can start by:
ast, compile, error, file, lexer, parser, token. Then we can continue our tests on the remaining files of the project.
from one.
Thank you Kotbi. @abdorah
Yeah, auto testing (unit-test, ...) is necessary for this project.
Yes, it's a good library, which I have no problem with.
These are the files that I think need to be tested:
- lexer.test.c
- parser.test.c
- ast.test.c
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)
And check if the tokens we get from the program are equal to the tokens we expect.
from one.
Now I see your fork. It's good, you moved the test file to another directory. ๐
arg-test is also a good idea.
You can pass fake argc,argv parameters and compare results.
If you have done this. please send your PR. It's welcome. @abdorah
Thanks
from one.
Thank you @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.
from one.
from one.
We have some tests that run on pull request.
We plan to add more. We also use pre-commit
.
from one.
Codewars training hey ?
You will have to ask @BaseMax what he thinks
from one.
Related Issues (20)
- ๐ชช Change License template ๐ชช
- โ Auto run pre-commit on top of Git โ HOT 2
- ๐ We need a much better link for "Getting Started" ๐ HOT 2
- ๐ฆ Only `Dockerize` if Docker files change on merge to main ๐ฆ HOT 3
- ๐๏ธ Fix Docker Build ๐๏ธ
- Forks should not Dockerize HOT 1
- ๐จ Change Formatting ๐จ HOT 3
- Configure link checker for twitter links HOT 1
- Add `markdown-link-check` to `pre-commit` HOT 2
- We need to update `CONTRIBUTORS.md` HOT 7
- ๐ Need to review `CONTRIBUTING.md` ๐
- โ Super-Linter add editorconfig-checker โ
- ๐งช Current pre-commit requirements and enhancements ๐งช HOT 3
- ๐ First Interaction GitHub Action Error ๐ HOT 3
- [Join] Core team HOT 1
- Pull request labeler is broken HOT 1
- ๐ Add the "Contributors" section from the English README to all READMEs ๐
- Errors found in GITHUB_ACTIONS
- ๐ Super-Linter - HTML errors ๐ HOT 2
- [Join] Website team HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from one.