Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Support testing #32

Closed
Closed
@mdinger

Description

@mdinger

A rustbyexample testing example is below. It would be cool if you could click Run or Test in the playpen when there is a test to be run.

fn distance(a: (f32, f32), b: (f32, f32)) -> f32 {
    (
        (b.val0().powi(2) - a.val0().powi(2)) +
        (b.val1().powi(2) - a.val1().powi(2))
    ).sqrt()
}

fn main() {
    println!("If you see this, the tests were not compiled nor ran!");
}

#[test]
fn distance_test() {
    assert!(distance((0f32, 0f32), (1f32, 1f32)) == (2f32).sqrt());
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions