Compare commits

...

1 Commits

Author SHA1 Message Date
e1f1051fe0 Grackle: Add Paul's QR code as a unit test 2024-03-17 10:54:42 -05:00
4 changed files with 2691 additions and 8 deletions

View File

@ -2007,7 +2007,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-execution-plan" name = "kittycad-execution-plan"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#4dfeb5c9ce2cc3fb853dd14cf948a922f3724ef4" source = "git+https://github.com/KittyCAD/modeling-api?branch=main#0fa02b1829e16ab67aca2f6153dc29e3fe3a358b"
dependencies = [ dependencies = [
"bytes", "bytes",
"insta", "insta",
@ -2027,7 +2027,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-execution-plan-macros" name = "kittycad-execution-plan-macros"
version = "0.1.9" version = "0.1.9"
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#4dfeb5c9ce2cc3fb853dd14cf948a922f3724ef4" source = "git+https://github.com/KittyCAD/modeling-api?branch=main#0fa02b1829e16ab67aca2f6153dc29e3fe3a358b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2037,7 +2037,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-execution-plan-traits" name = "kittycad-execution-plan-traits"
version = "0.1.13" version = "0.1.13"
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#4dfeb5c9ce2cc3fb853dd14cf948a922f3724ef4" source = "git+https://github.com/KittyCAD/modeling-api?branch=main#0fa02b1829e16ab67aca2f6153dc29e3fe3a358b"
dependencies = [ dependencies = [
"serde", "serde",
"thiserror", "thiserror",
@ -2046,8 +2046,8 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-cmds" name = "kittycad-modeling-cmds"
version = "0.1.30" version = "0.1.32"
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#4dfeb5c9ce2cc3fb853dd14cf948a922f3724ef4" source = "git+https://github.com/KittyCAD/modeling-api?branch=main#0fa02b1829e16ab67aca2f6153dc29e3fe3a358b"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@ -2075,7 +2075,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-cmds-macros" name = "kittycad-modeling-cmds-macros"
version = "0.1.2" version = "0.1.2"
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#4dfeb5c9ce2cc3fb853dd14cf948a922f3724ef4" source = "git+https://github.com/KittyCAD/modeling-api?branch=main#0fa02b1829e16ab67aca2f6153dc29e3fe3a358b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2085,7 +2085,7 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-session" name = "kittycad-modeling-session"
version = "0.1.1" version = "0.1.1"
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#4dfeb5c9ce2cc3fb853dd14cf948a922f3724ef4" source = "git+https://github.com/KittyCAD/modeling-api?branch=main#0fa02b1829e16ab67aca2f6153dc29e3fe3a358b"
dependencies = [ dependencies = [
"futures", "futures",
"kittycad", "kittycad",

View File

@ -61,7 +61,7 @@ pub enum Error {
#[error("Failed on instruction {instruction_index}:\n{error}\n\nInstruction contents were {instruction:#?}")] #[error("Failed on instruction {instruction_index}:\n{error}\n\nInstruction contents were {instruction:#?}")]
Execution { Execution {
error: ExecutionError, error: ExecutionError,
instruction: Instruction, instruction: Option<Instruction>,
instruction_index: usize, instruction_index: usize,
}, },
} }

View File

@ -1058,6 +1058,34 @@ fn kcvm_dbg(kcl_program: &str) {
.unwrap(); .unwrap();
} }
#[tokio::test]
async fn paul_qr_test() {
let program = include_str!("../testdata/paul_qr.kcl");
let ast = kcl_lib::parser::Parser::new(kcl_lib::token::lexer(program))
.ast()
.unwrap();
let mut client = Some(test_client().await);
crate::execute(ast, &mut client).await.unwrap();
use kittycad_modeling_cmds::{each_cmd, ok_response::OkModelingCmdResponse, ImageFormat};
let out = client
.unwrap()
.run_command(
uuid::Uuid::new_v4().into(),
each_cmd::TakeSnapshot {
format: ImageFormat::Png,
}
.into(),
)
.await
.unwrap();
let out = match out {
OkModelingCmdResponse::TakeSnapshot(b) => b,
other => panic!("wrong output: {other:?}"),
};
let out: Vec<u8> = out.contents.into();
std::fs::write("paul_qr_code.png", out).unwrap();
}
#[tokio::test] #[tokio::test]
async fn stdlib_cube_partial() { async fn stdlib_cube_partial() {
let program = r#" let program = r#"

2655
src/wasm-lib/grackle/testdata/paul_qr.kcl vendored Normal file

File diff suppressed because it is too large Load Diff