-
Notifications
You must be signed in to change notification settings - Fork 0
10 automatically add example from problem summary as native unit tests #17
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
10 automatically add example from problem summary as native unit tests #17
Conversation
|
Quelques notes: Bon déja, la CI a passé bien sur :) btw j'ai fait une issue pour update sur chaque commit -> #18. |
force |
|
deso mec je te fais ça ce wk. |
guilhem-sante
left a comment
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.
Nice les tests en plus. Je sais pas si tes checks de signatures sont 100% fonctionnels mais ça fait bien le taf.
src/main.rs
Outdated
| Commands::Info { | ||
| id, | ||
| } => { | ||
| println!("{}", api_runner.get_problem_info(*id).await?); | ||
| }, | ||
| Commands::Start { | ||
| id, | ||
| language, | ||
| } => { | ||
| let default = &rcs.config.default_language.unwrap(); | ||
| Commands::Info { id } => api_runner.get_problem_info(*id).await?, | ||
| Commands::Start { id, language } => { | ||
| let lang = match language { | ||
| Some(lang) => utils::parse_programming_language(lang)?, | ||
| None => utils::parse_programming_language(default)?, | ||
| None => utils::parse_programming_language( | ||
| &rcs.config |
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.
Tu peux regarder pour la version derived de clap avec la feature associé. Je trouve ça plus limpide moi. Aussi tu peux créer le runtime après avoir gérer la CLI, ça peut t'éviter de gérer l'async quand c'est pas encore nécessaire.
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.
Tu peux regarder pour la version derived de clap avec la feature associé.
ca fait quoi?
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.
globalement tu décris la CLI comme une structure plutot que impérativement, je ne sais pas si c'est forcément mieux mais ça a l'avantage d'être assez lisible.
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.
Je regarde ça asap
… and applying changes to code and test
c85889d to
6327d4c
Compare
Signed-off-by: dfayd <78728332+dfayd0@users.noreply.github.com>
Signed-off-by: dfayd <78728332+dfayd0@users.noreply.github.com>
Signed-off-by: dfayd <78728332+dfayd0@users.noreply.github.com>
This pull request introduces significant enhancements to the codebase, focusing on modularization, functionality improvements, and code cleanup. Key changes include the addition of a
CodeSignaturemodule for parsing and resolving code signatures, integration of aTestGeneratormodule for generating tests dynamically, and refactoring of theLeetcodeApiRunnerto streamline problem setup and testing workflows.New Modules and Features:
src/code_signature.rs: Added aCodeSignaturemodule to parse function and class signatures for Python and Rust code. This module also handles declaration resolution for test data.src/test_generator.rs: Introduced aTestGeneratormodule to dynamically generate test cases based on starter code and parsed test data. Supports Python and Rust test generation.Refactoring and Improvements in
LeetcodeApiRunner:start_problemmethod to use the newTestGeneratorandCodeSignaturemodules for generating starter code and tests. Improved error handling and modularity. [1] [2]utils::extension_programming_languagewithget_language_from_extensionfor better clarity and maintainability. [1] [2]cargo initcommand to include--binfor creating binary projects.Utility Enhancements:
src/utils.rs: Addedwrite_readmeas a utility function for creating README files. Refactoredget_file_nameto dynamically generate file names based on language extensions. [1] [2]Miscellaneous Changes:
code_signature,test_generator) tosrc/lib.rsfor better organization.