Open nimdanor opened 4 years ago
This will be a very convenient feature ! I'll win a lot of time with that (and avoid a ping-pong game between PLaTon and my computer).
Currently, I often copy paste whole files from the editor to my computer and run the command :
python3 -m doctest myfile.py -v
It will be very fine if the player/test button do that for pure python file :
Look for example at : Yggdrasil/ComputerScience/Games/MiniBrain/mini_brain_utils.py Yggdrasil/ComputerScience/Algo/Tree/templates/utils_binary_tree.py
I am just a little afraid with the " on the sandbox ". This will be better for sure (same environment as in deployment and safer if there is strong errors in the code....) but will this force to add new request API for the sandbox (so a long and hard job of dev ? and another issue for the PLaTon-sandox repo ?).
The mini_brain_utils.py launches, for example, 225 tests...
37 items passed all tests:
2 tests in minibrain
5 tests in minibrain.MiniBrain
1 tests in minibrain.MiniBrain.__init__
4 tests in minibrain.MiniBrain._add_line_verbose
9 tests in minibrain.MiniBrain.read_central_bus
7 tests in minibrain.MiniBrain.resolve_instructions
2 tests in minibrain.MiniBrain.run
14 tests in minibrain.MiniBrain.write_central_bus
2 tests in minibrain.MiniBrainMem
1 tests in minibrain.MiniBrainMem.__init__
2 tests in minibrain.MiniBrainMem.__str__
13 tests in minibrain.MiniBrainMem.analyse_instruction
4 tests in minibrain.MiniBrainMem.get_instruction
5 tests in minibrain.MiniBrainMem.set_value
7 tests in minibrain.MiniBrainUAL
1 tests in minibrain.MiniBrainUAL.__init__
2 tests in minibrain.MiniBrainUAL.__str__
8 tests in minibrain.MiniBrainUAL.add
8 tests in minibrain.MiniBrainUAL.cmp
8 tests in minibrain.MiniBrainUAL.dec
8 tests in minibrain.MiniBrainUAL.div
4 tests in minibrain.MiniBrainUAL.get_flag
4 tests in minibrain.MiniBrainUAL.get_program_counter
6 tests in minibrain.MiniBrainUAL.get_register
9 tests in minibrain.MiniBrainUAL.inc
7 tests in minibrain.MiniBrainUAL.increment_program_counter
8 tests in minibrain.MiniBrainUAL.mod
8 tests in minibrain.MiniBrainUAL.mul
4 tests in minibrain.MiniBrainUAL.set_flag_down
4 tests in minibrain.MiniBrainUAL.set_flag_up
4 tests in minibrain.MiniBrainUAL.set_program_counter
6 tests in minibrain.MiniBrainUAL.set_register
8 tests in minibrain.MiniBrainUAL.sub
4 tests in minibrain.MiniBrainUAL.wait_input_output
16 tests in minibrain.analyse_arg
9 tests in minibrain.represents_int
11 tests in minibrain.scale_16_bits_a2
225 tests in 37 items.
225 passed and 0 failed.
Test passed.
This is a feature for PremierLangage. This is not needed with platon that uses Visual code.
Feature Description If the file is a of type python (.py), then the test button execute on the sandbox a doctest of the python file.
Use Case When editing new exercices it's conviennent to be able to check the validity of the python code.
Additional Info
Maybe we could do this with the preview button?