Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Use statement tests

test

// use debug from `std/module.µcad`
use std::debug::assert;
assert(true);

// use all symbols from std::debug for test checks
use std::debug::*;

// use symbol `circle` in file `geo2d.µcad`
use std::geo2d::Circle;
assert_valid(Circle);

// use all symbols in file `geo3d.µcad`
use std::geo3d::*;
assert_valid(Sphere);
assert_valid(Cube);

// alias `Circle` in `std/geo2d/mod.µcad` into `foo`
use std::geo2d::Circle as foo;
assert_valid(foo);

// use print from `std/module.µcad`
use std::print;
assert_valid(print);
print("Hello");

// public use operation from `std/module.µcad`
pub use std::ops;
assert_valid(ops);
assert_valid(use_test::ops);

part MyPart() {
    Circle(radius=1);
    Sphere(radius=1);
}

assert_valid(MyPart);

test

use std::geo2d::*; 
use Rect as Cap;

Cap(width=1mm,height=1mm);

test

// use symbol `circle` in file `geo2d.µcad`
use std::geo2d::Circle;
// use all symbols in file `geo3d.µcad`
use std::geo3d::*;
// alias `bar` in `std/text/foo.µcad` into `baz`
use std::math::abs as baz;
// use print from `std/module.µcad`
use std::print;
// public use operation from `std/module.µcad`
pub use std::ops;

// use debug from `std/module.µcad`
use std::debug;
debug::assert(true);

part my_part3d() { Sphere(radius=1mm); }
part my_part2d() { Circle(radius=1mm); }

x = my_part2d();
y = my_part3d();
z = baz(-1.0);

test

fn f() {
    use std::math::abs;
    x = abs(-1.0);
    return x;
}
f();

test

fn f() {
    use std::math::*;
    x = abs(-1.0);
    return x;
}
f();

test

mod my {
    mod name {
        pub mod space {
            pub use std::geo2d::*;
        }
    }
    pub use name::space::*;
}

my::Circle(r = 4mm);
my::Rect(size = 40mm);