Fix sending detection
This commit is contained in:
parent
f60441ef9d
commit
2255aaff8b
@ -107,12 +107,12 @@ fn main()
|
|||||||
{
|
{
|
||||||
let f = f.unwrap();
|
let f = f.unwrap();
|
||||||
let file_content = fs::read_to_string(f.path()).unwrap();
|
let file_content = fs::read_to_string(f.path()).unwrap();
|
||||||
println!("========NOW TESTING '{:?}'========", f.path());
|
println!("========NOW TESTING {:?}========", f.path());
|
||||||
match compile(&file_content, &intrinsics, interpret, debug)
|
match compile(&file_content, &intrinsics, interpret, debug)
|
||||||
{
|
{
|
||||||
Ok(maybe_msg) =>
|
Ok(maybe_msg) =>
|
||||||
{
|
{
|
||||||
println!("---Successfully parsed '{:?}'---", f.path());
|
println!("---Successfully parsed {:?}---", f.path());
|
||||||
if let Some(msg) = &maybe_msg
|
if let Some(msg) = &maybe_msg
|
||||||
{
|
{
|
||||||
print!("---Output---\n'{}'\n", msg);
|
print!("---Output---\n'{}'\n", msg);
|
||||||
@ -141,14 +141,14 @@ fn main()
|
|||||||
println!("===PASSED===");
|
println!("===PASSED===");
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
else if let Some(index) = file_content.find(":END:")
|
else if let Some(index) = file_content.find("//:END:")
|
||||||
{
|
{
|
||||||
let expected_output = file_content[10..index].replace("\n//", "\n");
|
let expected_output = file_content[10..index].replace("\n//", "\n");
|
||||||
println!("\n\n===FAILED===\nExpected the output to be {}", expected_output);
|
println!("\n\n===FAILED===\nExpected the output to be {}", expected_output);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panic!("Could not find an ending marker (//:END:) for the expected output in {:?}", f.file_name());
|
panic!("Could not find an ending marker (:END:) for the expected output in {:?}", f.file_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,3 +23,67 @@ function bool bool bool => bool rule110
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function int => bool intToBool
|
||||||
|
{
|
||||||
|
0 !=
|
||||||
|
}
|
||||||
|
|
||||||
|
function bool => int boolToInt
|
||||||
|
{
|
||||||
|
if
|
||||||
|
{
|
||||||
|
1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
true 10
|
||||||
|
|
||||||
|
true 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
|
||||||
|
while
|
||||||
|
{
|
||||||
|
check
|
||||||
|
while
|
||||||
|
{
|
||||||
|
// 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
checkAndApply
|
||||||
|
// 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 true 31 0 0 0
|
||||||
|
shift-5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function any any any any any any any any any any any any any any any any any any any any any any any any any any any => any any any any any any any any any any any any any any any any any any any any any any any any any any any shift-5
|
||||||
|
{ }
|
||||||
|
|
||||||
|
function int int int int => bool int int int int checkAndApply
|
||||||
|
{
|
||||||
|
check apply
|
||||||
|
}
|
||||||
|
|
||||||
|
function int => bool int
|
||||||
|
{
|
||||||
|
0 dup 1 > req -
|
||||||
|
}
|
||||||
|
|
||||||
|
function int int int => int int int apply
|
||||||
|
{
|
||||||
|
// a b c
|
||||||
|
intToBool
|
||||||
|
// b c d
|
||||||
|
dup intToBool
|
||||||
|
// c d b e
|
||||||
|
dup intToBool
|
||||||
|
// d b e c f
|
||||||
|
req swp swp
|
||||||
|
// d e b f c
|
||||||
|
req req swp
|
||||||
|
// c d e f b
|
||||||
|
req rule110
|
||||||
|
// b c g
|
||||||
|
req req boolToInt
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user