From 241a7aeb340410e163583943819494859bc4815e Mon Sep 17 00:00:00 2001 From: Kirill Leonov Date: Sat, 27 Jan 2024 21:58:58 +0300 Subject: [PATCH 1/5] gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4fe70d9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.mc linguist-language=minicode From 8406e52c72b28fdf60600f7a48c1b76317774d77 Mon Sep 17 00:00:00 2001 From: Kirill Leonov Date: Sat, 27 Jan 2024 22:08:31 +0300 Subject: [PATCH 2/5] renamed file extensions --- .gitattributes | 2 +- test/examples/{arithmetic.mc => arithmetic.mcode} | 0 test/examples/{cli.mc => cli.mcode} | 0 test/examples/{condition.mc => condition.mcode} | 0 test/examples/{execute.mc => execute.mcode} | 0 .../{extended_conditions.mc => extended_conditions.mcode} | 0 test/examples/{fib.mc => fib.mcode} | 0 test/examples/{file_write.mc => file_write.mcode} | 0 test/examples/{float.mc => float.mcode} | 0 test/examples/{hello_world.mc => hello_world.mcode} | 0 test/examples/{inc_and_dec.mc => inc_and_dec.mcode} | 0 test/examples/{include.mc => include.mcode} | 0 test/examples/{more_or_less.mc => more_or_less.mcode} | 0 .../{output_by_characters.mc => output_by_characters.mcode} | 0 test/examples/{print_file.mc => print_file.mcode} | 0 15 files changed, 1 insertion(+), 1 deletion(-) rename test/examples/{arithmetic.mc => arithmetic.mcode} (100%) rename test/examples/{cli.mc => cli.mcode} (100%) rename test/examples/{condition.mc => condition.mcode} (100%) rename test/examples/{execute.mc => execute.mcode} (100%) rename test/examples/{extended_conditions.mc => extended_conditions.mcode} (100%) rename test/examples/{fib.mc => fib.mcode} (100%) rename test/examples/{file_write.mc => file_write.mcode} (100%) rename test/examples/{float.mc => float.mcode} (100%) rename test/examples/{hello_world.mc => hello_world.mcode} (100%) rename test/examples/{inc_and_dec.mc => inc_and_dec.mcode} (100%) rename test/examples/{include.mc => include.mcode} (100%) rename test/examples/{more_or_less.mc => more_or_less.mcode} (100%) rename test/examples/{output_by_characters.mc => output_by_characters.mcode} (100%) rename test/examples/{print_file.mc => print_file.mcode} (100%) diff --git a/.gitattributes b/.gitattributes index 4fe70d9..a4d13af 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -*.mc linguist-language=minicode +*.mcode linguist-language=minicode diff --git a/test/examples/arithmetic.mc b/test/examples/arithmetic.mcode similarity index 100% rename from test/examples/arithmetic.mc rename to test/examples/arithmetic.mcode diff --git a/test/examples/cli.mc b/test/examples/cli.mcode similarity index 100% rename from test/examples/cli.mc rename to test/examples/cli.mcode diff --git a/test/examples/condition.mc b/test/examples/condition.mcode similarity index 100% rename from test/examples/condition.mc rename to test/examples/condition.mcode diff --git a/test/examples/execute.mc b/test/examples/execute.mcode similarity index 100% rename from test/examples/execute.mc rename to test/examples/execute.mcode diff --git a/test/examples/extended_conditions.mc b/test/examples/extended_conditions.mcode similarity index 100% rename from test/examples/extended_conditions.mc rename to test/examples/extended_conditions.mcode diff --git a/test/examples/fib.mc b/test/examples/fib.mcode similarity index 100% rename from test/examples/fib.mc rename to test/examples/fib.mcode diff --git a/test/examples/file_write.mc b/test/examples/file_write.mcode similarity index 100% rename from test/examples/file_write.mc rename to test/examples/file_write.mcode diff --git a/test/examples/float.mc b/test/examples/float.mcode similarity index 100% rename from test/examples/float.mc rename to test/examples/float.mcode diff --git a/test/examples/hello_world.mc b/test/examples/hello_world.mcode similarity index 100% rename from test/examples/hello_world.mc rename to test/examples/hello_world.mcode diff --git a/test/examples/inc_and_dec.mc b/test/examples/inc_and_dec.mcode similarity index 100% rename from test/examples/inc_and_dec.mc rename to test/examples/inc_and_dec.mcode diff --git a/test/examples/include.mc b/test/examples/include.mcode similarity index 100% rename from test/examples/include.mc rename to test/examples/include.mcode diff --git a/test/examples/more_or_less.mc b/test/examples/more_or_less.mcode similarity index 100% rename from test/examples/more_or_less.mc rename to test/examples/more_or_less.mcode diff --git a/test/examples/output_by_characters.mc b/test/examples/output_by_characters.mcode similarity index 100% rename from test/examples/output_by_characters.mc rename to test/examples/output_by_characters.mcode diff --git a/test/examples/print_file.mc b/test/examples/print_file.mcode similarity index 100% rename from test/examples/print_file.mc rename to test/examples/print_file.mcode From b7bb5a56c1953da26893db944102add6be256436 Mon Sep 17 00:00:00 2001 From: Kirill Leonov Date: Sat, 27 Jan 2024 22:28:46 +0300 Subject: [PATCH 3/5] install script update --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 1ada12b..04c98e6 100644 --- a/install.sh +++ b/install.sh @@ -58,7 +58,7 @@ if command -v $exe_name --version >/dev/null; then printf "Run '\e[1;32m%s --help\e[0m' to get started\n" "$exe_name" else echo "Manually add the directory to your \$HOME/.bash_profile (or similar)" - echo " export PATH=${executable_folder}:\$PATH" + echo " echo 'export PATH=${executable_folder}:\$PATH' >> .bash_profile" printf "Run '\e[1;32m%s --help\e[0m' to get started\n" "$exe_name" fi From 0613fd7ea82506db17ff93d47b727dd8a01f0fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9B=D0=B5=D0=BE?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2?= <71232234+leonovk@users.noreply.github.com> Date: Sun, 28 Jan 2024 21:20:40 +0300 Subject: [PATCH 4/5] docs update (#24) --- .gitattributes | 1 - README.md | 2 +- docs/index.md | 4 +++- docs/ru.md | 4 +++- test/examples/include.mcode | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index a4d13af..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.mcode linguist-language=minicode diff --git a/README.md b/README.md index 0a4a807..e42c513 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ FROM minicode:latest COPY . . -CMD ["minicode", "-p", "hello_world.mc"] +CMD ["minicode", "-p", "hello_world.mcode"] ``` ## Contributing diff --git a/docs/index.md b/docs/index.md index 86df520..234ed99 100644 --- a/docs/index.md +++ b/docs/index.md @@ -227,9 +227,11 @@ For example, this is how you can write the current version of your minicode into You can include another minicode file into your code. The code will connect and be executed immediately. ```mc --> test/examples/hello_world.mc +-> test/examples/hello_world.mcode ``` +Just like when running regular minicode code, you can pass arguments to the command line, which will be available as ARG_1, ARG_2 and so on in the list + ## Some examples ### Fibonacci sequence diff --git a/docs/ru.md b/docs/ru.md index dd80669..1a9ea5b 100644 --- a/docs/ru.md +++ b/docs/ru.md @@ -217,9 +217,11 @@ p text Вы можете подключить другой файл с исходным кодом на миникоде, в ваш файл. Код из другого файла будет выполнен сразу. ```mc --> test/examples/hello_world.mc +-> test/examples/hello_world.mcode ``` +Точно также как и при запуске обычного миникод кода, вы можете передавать аргументы командой строки, который будут достпны как ARG_1, ARG_2 и так далее по списку + ## Некоторые примеры ### Последовательность фибоначчи diff --git a/test/examples/include.mcode b/test/examples/include.mcode index eb3c661..7592715 100644 --- a/test/examples/include.mcode +++ b/test/examples/include.mcode @@ -1,9 +1,9 @@ p text one --> test/examples/output_by_characters.mc +-> test/examples/output_by_characters.mcode p done p text two > a 1 > b 2 > c 3 --> test/examples/cli.mc a b c +-> test/examples/cli.mcode a b c p done again From 98433969ffc1a4d16694d9386e664a8dba1c72d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9B=D0=B5=D0=BE?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2?= <71232234+leonovk@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:21:56 +0300 Subject: [PATCH 5/5] Added parallelism feature (#25) --- Cargo.lock | 2 +- Cargo.toml | 2 +- docs/index.md | 10 ++++++++-- docs/ru.md | 8 +++++++- src/files/mod.rs | 4 ++-- src/interpreter/include.rs | 20 +++++++++++++++++-- src/interpreter/mod.rs | 18 ++++++++++++++++- src/opcode/mod.rs | 3 ++- src/parser/include.rs | 18 ++++++++++------- src/parser/mod.rs | 1 + src/parser/opcode_parser.rs | 7 +++++-- src/parser/sleep.rs | 15 ++++++++++++++ test/examples/file_write.mcode | 2 -- test/examples/include.mcode | 9 --------- test/examples/print_file.mcode | 2 -- {test => tests}/examples/arithmetic.mcode | 0 {test => tests}/examples/cli.mcode | 0 {test => tests}/examples/condition.mcode | 0 {test => tests}/examples/execute.mcode | 0 .../examples/extended_conditions.mcode | 0 {test => tests}/examples/fib.mcode | 0 tests/examples/file_write.mcode | 2 ++ {test => tests}/examples/float.mcode | 0 {test => tests}/examples/hello_world.mcode | 0 {test => tests}/examples/inc_and_dec.mcode | 0 tests/examples/include.mcode | 9 +++++++++ tests/examples/include_p.mcode | 5 +++++ {test => tests}/examples/more_or_less.mcode | 0 .../examples/output_by_characters.mcode | 0 tests/examples/print_file.mcode | 2 ++ tests/examples/sleep.mcode | 5 +++++ tests/examples/sleep_2.mcode | 2 ++ tests/examples/sleep_3.mcode | 2 ++ {test => tests}/test_file.txt | 0 34 files changed, 115 insertions(+), 33 deletions(-) create mode 100644 src/parser/sleep.rs delete mode 100644 test/examples/file_write.mcode delete mode 100644 test/examples/include.mcode delete mode 100644 test/examples/print_file.mcode rename {test => tests}/examples/arithmetic.mcode (100%) rename {test => tests}/examples/cli.mcode (100%) rename {test => tests}/examples/condition.mcode (100%) rename {test => tests}/examples/execute.mcode (100%) rename {test => tests}/examples/extended_conditions.mcode (100%) rename {test => tests}/examples/fib.mcode (100%) create mode 100644 tests/examples/file_write.mcode rename {test => tests}/examples/float.mcode (100%) rename {test => tests}/examples/hello_world.mcode (100%) rename {test => tests}/examples/inc_and_dec.mcode (100%) create mode 100644 tests/examples/include.mcode create mode 100644 tests/examples/include_p.mcode rename {test => tests}/examples/more_or_less.mcode (100%) rename {test => tests}/examples/output_by_characters.mcode (100%) create mode 100644 tests/examples/print_file.mcode create mode 100644 tests/examples/sleep.mcode create mode 100644 tests/examples/sleep_2.mcode create mode 100644 tests/examples/sleep_3.mcode rename {test => tests}/test_file.txt (100%) diff --git a/Cargo.lock b/Cargo.lock index 8c9d5ea..71329ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -758,7 +758,7 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "minicode" -version = "1.3.6" +version = "1.3.7" dependencies = [ "clap", "pretty_assertions", diff --git a/Cargo.toml b/Cargo.toml index 00d2567..0cce53e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "minicode" -version = "1.3.6" +version = "1.3.7" authors = ["Kirill Leonov "] edition = "2021" repository = "https://github.com/leonovk/minicode" diff --git a/docs/index.md b/docs/index.md index 234ed99..51e76b0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -199,7 +199,7 @@ p text The greater than or less than operators '>', '<' are also supported -You will find more examples in the folder -> test/examples +You will find more examples in the folder -> tests/examples ## Write data to file @@ -227,11 +227,17 @@ For example, this is how you can write the current version of your minicode into You can include another minicode file into your code. The code will connect and be executed immediately. ```mc --> test/examples/hello_world.mcode +-> tests/examples/hello_world.mcode ``` Just like when running regular minicode code, you can pass arguments to the command line, which will be available as ARG_1, ARG_2 and so on in the list +If you specify a long arrow as a command, as in the example below, then the following code will be executed asynchronously. + +```mc +--> tests/examples/hello_world.mcode +``` + ## Some examples ### Fibonacci sequence diff --git a/docs/ru.md b/docs/ru.md index 1a9ea5b..51c9c5f 100644 --- a/docs/ru.md +++ b/docs/ru.md @@ -217,11 +217,17 @@ p text Вы можете подключить другой файл с исходным кодом на миникоде, в ваш файл. Код из другого файла будет выполнен сразу. ```mc --> test/examples/hello_world.mcode +-> tests/examples/hello_world.mcode ``` Точно также как и при запуске обычного миникод кода, вы можете передавать аргументы командой строки, который будут достпны как ARG_1, ARG_2 и так далее по списку +Если указать длинную стрелочку в качестве команды, как на примере ниже, то сладеюущий код будет выполнятся асинхронно. + +```mc +--> tests/examples/hello_world.mcode +``` + ## Некоторые примеры ### Последовательность фибоначчи diff --git a/src/files/mod.rs b/src/files/mod.rs index e5c154d..8a0b661 100644 --- a/src/files/mod.rs +++ b/src/files/mod.rs @@ -36,7 +36,7 @@ mod tests { #[test] fn test_get_lines() { - let path = "test/test_file.txt".to_string(); + let path = "tests/test_file.txt".to_string(); assert_eq!( get_lines(&path), vec!["first".to_string(), "second".to_string()] @@ -45,7 +45,7 @@ mod tests { #[test] fn test_get_content() { - let path = "test/test_file.txt".to_string(); + let path = "tests/test_file.txt".to_string(); assert_eq!(get_content(&path), "first\nsecond".to_string()); } } diff --git a/src/interpreter/include.rs b/src/interpreter/include.rs index 30dff72..65f0282 100644 --- a/src/interpreter/include.rs +++ b/src/interpreter/include.rs @@ -2,8 +2,14 @@ use crate::code_runner::run; use crate::opcode::ValueType; use crate::opcode::ValueType::*; use std::collections::HashMap; +use std::thread::{self, JoinHandle}; -pub fn include(file: &String, args: &Vec, storage: &HashMap<&String, ValueType>) { +pub fn include( + file: &String, + args: &Vec, + storage: &HashMap<&String, ValueType>, + stream: &bool, +) -> Option> { let mut result_args_value = Vec::new(); for arg in args { @@ -16,5 +22,15 @@ pub fn include(file: &String, args: &Vec, storage: &HashMap<&String, Val }; } - run(file.to_string(), result_args_value); + if *stream { + let file_clone = file.clone(); + let handle = thread::spawn(|| { + run(file_clone, result_args_value); + }); + + Some(handle) + } else { + run(file.to_string(), result_args_value); + None + } } diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 7ea9bcd..962de11 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -3,6 +3,8 @@ use crate::opcode::OpCode::*; use crate::opcode::ValueType; use crate::opcode::ValueType::*; use std::collections::HashMap; +use std::thread; +use std::time::Duration; mod calculate; mod condition; mod create; @@ -26,6 +28,8 @@ pub fn exegete(operations: Vec, args: Vec) { let code_max_point = operations.len() - 1; let mut pointer: usize = 0; let mut addresses: HashMap<&String, ValueType> = HashMap::new(); + let mut parallel_computing = Vec::new(); + let c_args = parse_command_line_arguments(args); for (key, value) in &c_args { @@ -51,12 +55,24 @@ pub fn exegete(operations: Vec, args: Vec) { } PrintFile(key, path) => print_file(key, path, &addresses), Execute(k, c, arg) => execute(k, c, arg, &mut addresses), - Include(p, a) => include(p, a, &addresses), + Include(p, a, s) => { + let result = include(p, a, &addresses, s); + + match result { + Some(h) => parallel_computing.push(h), + None => {} + } + } + Sleep(i) => thread::sleep(Duration::from_secs(*i)), EmptyLine => {} } pointer += 1; } + + for compute in parallel_computing { + compute.join().expect("error"); + } } fn parse_command_line_arguments(args: Vec) -> HashMap { diff --git a/src/opcode/mod.rs b/src/opcode/mod.rs index 4fc3073..817ec77 100644 --- a/src/opcode/mod.rs +++ b/src/opcode/mod.rs @@ -29,6 +29,7 @@ pub enum OpCode { Condition(String, ValueType, ComparisonOperators, usize), ErrorCode(String), Execute(String, String, Vec), - Include(String, Vec), + Include(String, Vec, bool), + Sleep(u64), EmptyLine, } diff --git a/src/parser/include.rs b/src/parser/include.rs index ccdee88..c4a2716 100644 --- a/src/parser/include.rs +++ b/src/parser/include.rs @@ -1,7 +1,7 @@ pub use crate::opcode::OpCode; pub use crate::opcode::OpCode::*; -pub fn include(data: Vec<&str>) -> OpCode { +pub fn include(data: Vec<&str>, stream: bool) -> OpCode { if data.len() < 2 { return ErrorCode("the operation is not specified correctly".to_string()); } @@ -14,7 +14,7 @@ pub fn include(data: Vec<&str>) -> OpCode { args.push(arg.to_string()); } - Include(value_name, args) + Include(value_name, args, stream) } #[cfg(test)] @@ -26,24 +26,28 @@ mod tests { #[test] fn test_include_one() { let data = vec!["->", "a", "b", "c"]; - let result = include(data); + let result = include(data, false); assert_eq!( result, - Include("a".to_string(), vec!["b".to_string(), "c".to_string()]) + Include( + "a".to_string(), + vec!["b".to_string(), "c".to_string()], + false + ) ); } #[test] fn test_include_two() { let data = vec!["->", "a"]; - let result = include(data); - assert_eq!(result, Include("a".to_string(), vec![])); + let result = include(data, true); + assert_eq!(result, Include("a".to_string(), vec![], true)); } #[test] fn test_include_three() { let data = vec!["p"]; - let result = include(data); + let result = include(data, false); assert_eq!( result, ErrorCode("the operation is not specified correctly".to_string()) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 2992218..62310fe 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -6,6 +6,7 @@ mod file; mod include; mod opcode_parser; mod print; +mod sleep; mod user_var; mod write; use crate::opcode::*; diff --git a/src/parser/opcode_parser.rs b/src/parser/opcode_parser.rs index 9ebff62..4f39749 100644 --- a/src/parser/opcode_parser.rs +++ b/src/parser/opcode_parser.rs @@ -8,6 +8,7 @@ use super::exec::exec; use super::file::file; use super::include::include; use super::print::print; +use super::sleep::sleep; use super::user_var::user_var; use super::write::file_write; @@ -24,7 +25,9 @@ pub fn get_opcode(line: &String) -> OpCode { "?" => condition(data), ">>" => file_write(data), "&" => exec(data), - "->" => include(data), + "->" => include(data, false), + "-->" => include(data, true), + "sleep" => sleep(data), _ => ErrorCode("Could not recognize the command".to_string()), } } @@ -52,7 +55,7 @@ mod tests { #[test] fn test_get_opcode_file() { - let ex1 = "f a test/test_file.txt".to_string(); + let ex1 = "f a tests/test_file.txt".to_string(); assert_eq!( get_opcode(&ex1), diff --git a/src/parser/sleep.rs b/src/parser/sleep.rs new file mode 100644 index 0000000..cd65100 --- /dev/null +++ b/src/parser/sleep.rs @@ -0,0 +1,15 @@ +use crate::opcode::OpCode; +use crate::opcode::OpCode::*; + +pub fn sleep(data: Vec<&str>) -> OpCode { + if data.len() != 2 { + return ErrorCode("the operation is not specified correctly".to_string()); + } + + let value = match data[1].to_string().parse::() { + Ok(parsed) => Sleep(parsed), + Err(_e) => ErrorCode("the operation is not specified correctly".to_string()), + }; + + value +} diff --git a/test/examples/file_write.mcode b/test/examples/file_write.mcode deleted file mode 100644 index fd9fba6..0000000 --- a/test/examples/file_write.mcode +++ /dev/null @@ -1,2 +0,0 @@ -> a hello world ->> test/test.txt a diff --git a/test/examples/include.mcode b/test/examples/include.mcode deleted file mode 100644 index 7592715..0000000 --- a/test/examples/include.mcode +++ /dev/null @@ -1,9 +0,0 @@ -p text one --> test/examples/output_by_characters.mcode -p done -p text two -> a 1 -> b 2 -> c 3 --> test/examples/cli.mcode a b c -p done again diff --git a/test/examples/print_file.mcode b/test/examples/print_file.mcode deleted file mode 100644 index 91df168..0000000 --- a/test/examples/print_file.mcode +++ /dev/null @@ -1,2 +0,0 @@ -f a test/test_file.txt -p a diff --git a/test/examples/arithmetic.mcode b/tests/examples/arithmetic.mcode similarity index 100% rename from test/examples/arithmetic.mcode rename to tests/examples/arithmetic.mcode diff --git a/test/examples/cli.mcode b/tests/examples/cli.mcode similarity index 100% rename from test/examples/cli.mcode rename to tests/examples/cli.mcode diff --git a/test/examples/condition.mcode b/tests/examples/condition.mcode similarity index 100% rename from test/examples/condition.mcode rename to tests/examples/condition.mcode diff --git a/test/examples/execute.mcode b/tests/examples/execute.mcode similarity index 100% rename from test/examples/execute.mcode rename to tests/examples/execute.mcode diff --git a/test/examples/extended_conditions.mcode b/tests/examples/extended_conditions.mcode similarity index 100% rename from test/examples/extended_conditions.mcode rename to tests/examples/extended_conditions.mcode diff --git a/test/examples/fib.mcode b/tests/examples/fib.mcode similarity index 100% rename from test/examples/fib.mcode rename to tests/examples/fib.mcode diff --git a/tests/examples/file_write.mcode b/tests/examples/file_write.mcode new file mode 100644 index 0000000..2593598 --- /dev/null +++ b/tests/examples/file_write.mcode @@ -0,0 +1,2 @@ +> a hello world +>> tests/test.txt a diff --git a/test/examples/float.mcode b/tests/examples/float.mcode similarity index 100% rename from test/examples/float.mcode rename to tests/examples/float.mcode diff --git a/test/examples/hello_world.mcode b/tests/examples/hello_world.mcode similarity index 100% rename from test/examples/hello_world.mcode rename to tests/examples/hello_world.mcode diff --git a/test/examples/inc_and_dec.mcode b/tests/examples/inc_and_dec.mcode similarity index 100% rename from test/examples/inc_and_dec.mcode rename to tests/examples/inc_and_dec.mcode diff --git a/tests/examples/include.mcode b/tests/examples/include.mcode new file mode 100644 index 0000000..eb049aa --- /dev/null +++ b/tests/examples/include.mcode @@ -0,0 +1,9 @@ +p text one +-> tests/examples/output_by_characters.mcode +p done +p text two +> a 1 +> b 2 +> c 3 +-> tests/examples/cli.mcode a b c +p done again diff --git a/tests/examples/include_p.mcode b/tests/examples/include_p.mcode new file mode 100644 index 0000000..ba2953b --- /dev/null +++ b/tests/examples/include_p.mcode @@ -0,0 +1,5 @@ +p start +--> tests/examples/sleep.mcode +--> tests/examples/sleep_2.mcode +--> tests/examples/sleep_3.mcode +p stop diff --git a/test/examples/more_or_less.mcode b/tests/examples/more_or_less.mcode similarity index 100% rename from test/examples/more_or_less.mcode rename to tests/examples/more_or_less.mcode diff --git a/test/examples/output_by_characters.mcode b/tests/examples/output_by_characters.mcode similarity index 100% rename from test/examples/output_by_characters.mcode rename to tests/examples/output_by_characters.mcode diff --git a/tests/examples/print_file.mcode b/tests/examples/print_file.mcode new file mode 100644 index 0000000..674e436 --- /dev/null +++ b/tests/examples/print_file.mcode @@ -0,0 +1,2 @@ +f a tests/test_file.txt +p a diff --git a/tests/examples/sleep.mcode b/tests/examples/sleep.mcode new file mode 100644 index 0000000..e52ab47 --- /dev/null +++ b/tests/examples/sleep.mcode @@ -0,0 +1,5 @@ +> text lol kek cheburek +p start sleep now +sleep 10 +p stop sleep now +p text diff --git a/tests/examples/sleep_2.mcode b/tests/examples/sleep_2.mcode new file mode 100644 index 0000000..20d4879 --- /dev/null +++ b/tests/examples/sleep_2.mcode @@ -0,0 +1,2 @@ +p sleep 2 +sleep 10 diff --git a/tests/examples/sleep_3.mcode b/tests/examples/sleep_3.mcode new file mode 100644 index 0000000..8a53c6f --- /dev/null +++ b/tests/examples/sleep_3.mcode @@ -0,0 +1,2 @@ +p sleep 3 +sleep 10 diff --git a/test/test_file.txt b/tests/test_file.txt similarity index 100% rename from test/test_file.txt rename to tests/test_file.txt