Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fc1943s committed Oct 18, 2024
1 parent dfdc027 commit 633a76f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 46 deletions.
2 changes: 1 addition & 1 deletion apps/chat/contract/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $targetDir = GetTargetDir $projectName

cargo fmt --

{ cargo build --release --target wasm32-unknown-unknown } | Invoke-Block -EnvironmentVariables @{ "AUTOMATION" = "False" }
{ cargo +nightly-2024-07-14 build --release --target wasm32-unknown-unknown } | Invoke-Block -EnvironmentVariables @{ "AUTOMATION" = "False" }
New-Item dist -ItemType Directory -Force | Out-Null
Copy-Item ../../../workspace/target/wasm32-unknown-unknown/release/chat_contract.wasm dist/chat.wasm -Force

Expand Down
60 changes: 32 additions & 28 deletions lib/spiral/file_system_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1960,9 +1960,12 @@ pub mod File_system {
pub fn method80() -> Func1<std::path::PathBuf, File_system::US14> {
Func1::new(move |v: std::path::PathBuf| File_system::closure49((), v))
}
pub fn method81(v0_1: string) -> string {
pub fn method82(v0_1: string) -> string {
v0_1
}
pub fn method81(v0_1: string, v1_1: string, v2_1: string) -> string {
unbox::<string>(&defaultOf())
}
pub fn method75(v0_1: string) -> string {
if v0_1.clone() == string("") {
string("")
Expand Down Expand Up @@ -3484,7 +3487,7 @@ pub mod File_system {
File_system::US14::US14_1,
map(File_system::method80(), v13141),
);
if match &v13161 {
let v13193: string = match &v13161 {
File_system::US14::US14_0(v13161_0_0) => {
let v13187: string = toString(
match &v13161 {
Expand All @@ -3500,16 +3503,17 @@ pub mod File_system {
}
}
_ => v0_1.clone(),
} == string("")
{
};
if v13193.clone() == string("") {
string("")
} else {
let v13234: string = unbox::<string>(&defaultOf());
let v13198: string =
File_system::method81(string("^\\\\\\\\\\?\\\\"), string(""), v13193);
replace(
sprintf!(
"{}{}",
toLower(ofChar(getCharAt(v13234.clone(), 0_i32))),
getSlice(v13234, Some(1_i32), None::<i32>)
toLower(ofChar(getCharAt(v13198.clone(), 0_i32))),
getSlice(v13198, Some(1_i32), None::<i32>)
),
string("\\"),
string("/"),
Expand All @@ -3526,21 +3530,21 @@ pub mod File_system {
pub fn closure52(unitVar: (), v0_1: string) -> Option<string> {
File_system::method78(v0_1)
}
pub fn method83() -> Func1<string, Option<string>> {
pub fn method84() -> Func1<string, Option<string>> {
Func1::new(move |v: string| File_system::closure52((), v))
}
pub fn method84(v0_1: string, v1_1: string, v2_1: string) -> File_system::US15 {
pub fn method85(v0_1: string, v1_1: string, v2_1: string) -> File_system::US15 {
let v0_1: MutCell<string> = MutCell::new(v0_1.clone());
let v1_1: MutCell<string> = MutCell::new(v1_1.clone());
let v2_1: MutCell<string> = MutCell::new(v2_1.clone());
'_method84: loop {
break '_method84 (if File_system::method9(File_system::method56(
'_method85: loop {
break '_method85 (if File_system::method9(File_system::method56(
v2_1.get().clone(),
v0_1.get().clone(),
)) {
File_system::US15::US15_0(v2_1.get().clone())
} else {
let v7: Option<string> = (File_system::method83())(v2_1.get().clone());
let v7: Option<string> = (File_system::method84())(v2_1.get().clone());
let v21_1: File_system::US1 =
defaultValue(File_system::US1::US1_1, map(File_system::method4(), v7));
match &v21_1 {
Expand All @@ -3554,7 +3558,7 @@ pub mod File_system {
v0_1.set(v0_1_temp);
v1_1.set(v1_1_temp);
v2_1.set(v2_1_temp);
continue '_method84;
continue '_method85;
}
_ => File_system::US15::US15_1(sprintf!(
"No parent for {} \'{}\' at \'{}\' (until \'{}\')",
Expand All @@ -3567,15 +3571,15 @@ pub mod File_system {
});
}
}
pub fn method82(v0_1: string, v1_1: string) -> File_system::US15 {
pub fn method83(v0_1: string, v1_1: string) -> File_system::US15 {
if File_system::method9(File_system::method56(v1_1.clone(), v0_1.clone())) {
File_system::US15::US15_0(v1_1.clone())
} else {
let v6: Option<string> = (File_system::method83())(v1_1.clone());
let v6: Option<string> = (File_system::method84())(v1_1.clone());
let v20_1: File_system::US1 =
defaultValue(File_system::US1::US1_1, map(File_system::method4(), v6));
match &v20_1 {
File_system::US1::US1_0(v20_1_0_0) => File_system::method84(
File_system::US1::US1_0(v20_1_0_0) => File_system::method85(
v0_1.clone(),
v1_1.clone(),
match &v20_1 {
Expand All @@ -3593,7 +3597,7 @@ pub mod File_system {
}
}
}
pub fn method86(v0_1: string) -> string {
pub fn method87(v0_1: string) -> string {
let v2_1: LrcPtr<File_system::Mut3> = LrcPtr::new(File_system::Mut3 {
l0: MutCell::new(File_system::method17()),
});
Expand All @@ -3619,7 +3623,7 @@ pub mod File_system {
};
v2_1.l0.get().clone()
}
pub fn method85(
pub fn method86(
v0_1: LrcPtr<File_system::Mut0>,
v1_1: LrcPtr<File_system::Mut1>,
v2_1: LrcPtr<File_system::Mut2>,
Expand All @@ -3630,7 +3634,7 @@ pub mod File_system {
v7: string,
v8: string,
) -> string {
let v9: string = File_system::method86(v8);
let v9: string = File_system::method87(v8);
File_system::method22(sprintf!(
"{} {} #{} {} / {}",
v6,
Expand Down Expand Up @@ -3660,7 +3664,7 @@ pub mod File_system {
let v21_1: LrcPtr<File_system::Mut2> = patternInput.2.clone();
let v20_1: LrcPtr<File_system::Mut1> = patternInput.1.clone();
let v19_1: LrcPtr<File_system::Mut0> = patternInput.0.clone();
File_system::method23(File_system::method85(
File_system::method23(File_system::method86(
v19_1.clone(),
v20_1.clone(),
v21_1.clone(),
Expand All @@ -3673,11 +3677,11 @@ pub mod File_system {
))
};
}
pub fn method87() -> string {
pub fn method88() -> string {
unbox::<string>(&defaultOf())
}
pub fn closure51(unitVar: (), unitVar_1: ()) -> string {
let v4: File_system::US15 = File_system::method82(
let v4: File_system::US15 = File_system::method83(
File_system::method56(string("polyglot"), string(".devcontainer")),
string("C:\\home\\git\\polyglot\\lib\\spiral"),
);
Expand All @@ -3697,8 +3701,8 @@ pub mod File_system {
_ => unreachable!(),
}),
_ => {
let v55: string = File_system::method87();
let v57: File_system::US15 = File_system::method82(
let v55: string = File_system::method88();
let v57: File_system::US15 = File_system::method83(
File_system::method56(string("polyglot"), string(".devcontainer")),
v55,
);
Expand All @@ -3725,12 +3729,12 @@ pub mod File_system {
string("polyglot"),
)
}
pub fn method88(v0_1: string) {
pub fn method89(v0_1: string) {
();
()
}
pub fn closure55(unitVar: (), v0_1: string) {
File_system::method88(v0_1);
File_system::method89(v0_1);
}
pub fn closure54(unitVar: (), v0_1: bool) {
let v3: () = {
Expand All @@ -3753,7 +3757,7 @@ pub mod File_system {
(patternInput.1.clone()).l0.set(v37);
()
}
pub fn method89(v0_1: string, v1_1: string) {
pub fn method90(v0_1: string, v1_1: string) {
if File_system::method9(v0_1.clone()) == false {
let v4: LrcPtr<dyn IDisposable> = File_system::method61(v0_1);
()
Expand Down Expand Up @@ -5338,7 +5342,7 @@ pub mod File_system {
}
}
pub fn closure57(v0_1: string, v1_1: string) {
File_system::method89(v0_1, v1_1);
File_system::method90(v0_1, v1_1);
}
pub fn closure56(unitVar: (), v0_1: string) -> Func1<string, ()> {
Func1::new({
Expand Down
37 changes: 20 additions & 17 deletions lib/spiral/sm_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@ pub mod Sm {
move |v: string| Sm::closure11(v0_1.clone(), v)
})
}
pub fn method0(v0_1: string) -> string {
pub fn method1(v0_1: string) -> string {
v0_1
}
pub fn closure15(v0_1: string, v1_1: string, v2_1: string) -> string {
pub fn method0(v0_1: string, v1_1: string, v2_1: string) -> string {
unbox::<string>(&defaultOf())
}
pub fn closure15(v0_1: string, v1_1: string, v2_1: string) -> string {
Sm::method0(v0_1, v1_1, v2_1)
}
pub fn closure14(v0_1: string, v1_1: string) -> Func1<string, string> {
Func1::new({
let v0_1 = v0_1.clone();
Expand Down Expand Up @@ -181,12 +184,12 @@ pub mod Sm {
move |v: string| Sm::closure20(v0_1.clone(), v)
})
}
pub fn method1() -> string {
pub fn method2() -> string {
string("")
}
pub fn closure22(v0_1: Array<string>, v1_1: string) -> Array<string> {
let v27: LrcPtr<dyn IEnumerable_1<string>> = ofArray(v0_1);
split_1(v1_1, join(Sm::method1(), toArray(v27)), -1_i32, 0_i32)
split_1(v1_1, join(Sm::method2(), toArray(v27)), -1_i32, 0_i32)
}
pub fn closure21(unitVar: (), v0_1: Array<string>) -> Func1<string, Array<string>> {
Func1::new({
Expand Down Expand Up @@ -237,18 +240,18 @@ pub mod Sm {
move |v: LrcPtr<Sm::UH0>| Sm::closure33(v0_1, v)
})
}
pub fn method2() -> Func1<char, Func1<LrcPtr<Sm::UH0>, LrcPtr<Sm::UH0>>> {
pub fn method3() -> Func1<char, Func1<LrcPtr<Sm::UH0>, LrcPtr<Sm::UH0>>> {
Func1::new(move |v: char| Sm::closure32((), v))
}
pub fn method3(v0_1: LrcPtr<Sm::UH0>, v1_1: List<char>) -> List<char> {
pub fn method4(v0_1: LrcPtr<Sm::UH0>, v1_1: List<char>) -> List<char> {
match v0_1.as_ref() {
Sm::UH0::UH0_0 => v1_1.clone(),
Sm::UH0::UH0_1(v0_1_1_0, v0_1_1_1) => cons(
match v0_1.as_ref() {
Sm::UH0::UH0_1(x, _) => x.clone(),
_ => unreachable!(),
},
Sm::method3(
Sm::method4(
match v0_1.as_ref() {
Sm::UH0::UH0_1(_, x) => x.clone(),
_ => unreachable!(),
Expand All @@ -259,12 +262,12 @@ pub mod Sm {
}
}
pub fn closure34(v0_1: LrcPtr<Sm::UH0>, v1_1: string) -> string {
trimEndChars(v1_1, toArray_1(Sm::method3(v0_1, empty::<char>())))
trimEndChars(v1_1, toArray_1(Sm::method4(v0_1, empty::<char>())))
}
pub fn closure31(unitVar: (), v0_1: Array<char>) -> Func1<string, string> {
let v1_1: List<char> = ofArray_1(v0_1);
let v7_1: LrcPtr<Sm::UH0> = foldBack(
Func2::new(move |b0: char, b1: LrcPtr<Sm::UH0>| (Sm::method2())(b0)(b1)),
Func2::new(move |b0: char, b1: LrcPtr<Sm::UH0>| (Sm::method3())(b0)(b1)),
v1_1,
LrcPtr::new(Sm::UH0::UH0_0),
);
Expand All @@ -274,12 +277,12 @@ pub mod Sm {
})
}
pub fn closure36(v0_1: LrcPtr<Sm::UH0>, v1_1: string) -> string {
trimStartChars(v1_1, toArray_1(Sm::method3(v0_1, empty::<char>())))
trimStartChars(v1_1, toArray_1(Sm::method4(v0_1, empty::<char>())))
}
pub fn closure35(unitVar: (), v0_1: Array<char>) -> Func1<string, string> {
let v1_1: List<char> = ofArray_1(v0_1);
let v7_1: LrcPtr<Sm::UH0> = foldBack(
Func2::new(move |b0: char, b1: LrcPtr<Sm::UH0>| (Sm::method2())(b0)(b1)),
Func2::new(move |b0: char, b1: LrcPtr<Sm::UH0>| (Sm::method3())(b0)(b1)),
v1_1,
LrcPtr::new(Sm::UH0::UH0_0),
);
Expand All @@ -304,7 +307,7 @@ pub mod Sm {
move |v: string| Sm::closure38(v0_1, v)
})
}
pub fn method4(v0_1: i64, v1_1: string) -> string {
pub fn method5(v0_1: i64, v1_1: string) -> string {
let v2_1: i64 = length(v1_1.clone()) as i64;
if v2_1 <= v0_1 {
v1_1.clone()
Expand All @@ -331,7 +334,7 @@ pub mod Sm {
}
}
pub fn closure40(v0_1: i64, v1_1: string) -> string {
Sm::method4(v0_1, v1_1)
Sm::method5(v0_1, v1_1)
}
pub fn closure39(unitVar: (), v0_1: i64) -> Func1<string, string> {
Func1::new({
Expand All @@ -342,7 +345,7 @@ pub mod Sm {
pub fn closure41(unitVar: (), v0_1: LrcPtr<Exception>) -> string {
sprintf!("{:?}", v0_1)
}
pub fn method5(v0_1: i32, v1_1: LrcPtr<Sm::Mut0>) -> bool {
pub fn method6(v0_1: i32, v1_1: LrcPtr<Sm::Mut0>) -> bool {
v1_1.l0.get().clone() < v0_1
}
pub fn closure43(v0_1: string, v1_1: Array<string>) -> string {
Expand All @@ -351,7 +354,7 @@ pub mod Sm {
l0: MutCell::new(0_i32),
l1: MutCell::new(string("")),
});
while Sm::method5(v2_1, v4_1.clone()) {
while Sm::method6(v2_1, v4_1.clone()) {
let v6_1: i32 = v4_1.l0.get().clone();
let v9_1: string = append(
append(
Expand Down Expand Up @@ -394,7 +397,7 @@ pub mod Sm {
move |v: Array<string>| Sm::closure47(v0_1.clone(), v)
})
}
pub fn method6(v0_1: i32, v1_1: LrcPtr<Sm::Mut1>) -> bool {
pub fn method7(v0_1: i32, v1_1: LrcPtr<Sm::Mut1>) -> bool {
v1_1.l0.get().clone() < v0_1
}
pub fn closure48(unitVar: (), v0_1: string) -> Array<char> {
Expand All @@ -403,7 +406,7 @@ pub mod Sm {
let v3_1: LrcPtr<Sm::Mut1> = LrcPtr::new(Sm::Mut1 {
l0: MutCell::new(0_i32),
});
while Sm::method6(v1_1, v3_1.clone()) {
while Sm::method7(v1_1, v3_1.clone()) {
let v5_1: i32 = v3_1.l0.get().clone();
let v6_1: char = getCharAt(v0_1.clone(), v5_1);
v2_1.get_mut()[v5_1 as usize] = v6_1;
Expand Down

0 comments on commit 633a76f

Please sign in to comment.