Giter Site home page Giter Site logo

scoredtests.jl's Introduction

ScoredTests.jl

ScoredTests.jl is a tiny package providing

  • @scoredtest expr [award] [penalty] [name] macro;
  • and ScoredTestSet([description]).

The macro evaluates an expression giving result of the test: was it passed, failed or errored during testing.

When a test is passed, it gives award, when failed or errored it takes penalty.

Tests (and testsets) can be grouped into ScoredTestSet-s via *= orepand.

MWE

julia> using ScoredTests
julia> ts = ScoredTestSet("Basic math");
julia> ts2 = ScoredTestSet("Trigonometry");
julia> ts2 *= @scoredtest sin(x)^2 + cos(x)^2 == 1;
julia> ts2 *= @scoredtest sin(10)^2 + cos(10)^2 == 1;
julia> ts2 *= @scoredtest sin(-1) / cos(-1) == tan(-1) name="Tangent definition";
julia> ts *= ts2;
julia> ts3 = ScoredTestSet("Quadratic polynomials");
julia> ts3 *= @scoredtest (1 + 2)^2 == 1^2 + 2*1*2 + 2^2 name="Square of sum" award=5;
julia> ts3 *= @scoredtest (1 - 2)^2 == 1^2 + 2*1*2 + 2^2 name="Square of difference";
julia> ts3 *= @scoredtest 3^2 - 4^2 == (3 - x)(3 + x) penalty=2;
julia> ts *= ts3;

julia> printsummary(ts)
Basic math

Trigonometry
No.   Result  Score  [Name]  [Error]
   1       E     -1  Error occured: UndefVarError(:x)
   2       ✓      1
   3       ✗     -1  Tangent definition

Quadratic polynomials
No.   Result  Score  [Name]  [Error]
   4       ✓      5  Square of sum
   5       ✗     -1  Square of difference
   6       E     -2  Error occured: UndefVarError(:x)

Summary
  Passed 2 test(s) of 6 [33.3%] and 2 of test(s) throw(s) exception(s)
  Achieved 1 point(s) of 10 [10.0%]

Use case

Originally, the package is supposed to be used by teachers and student in the following manner

Teacher perspective

  • Create a repo (or template) of package, containing task and scored testset.

Student perspective

  • Clone the repo, complete task, check score via julia --project=Project.toml test/runtests.jl or from REPL pkg> mode.

scoredtests.jl's People

Contributors

stepanzh avatar

Stargazers

 avatar

Watchers

 avatar

scoredtests.jl's Issues

Catch errors inside testset

Example

maints = ScoredTestSet("Реализация модуля Points")

maints *= let ts = ScoredTestSet("Линейные операции")
    p₁ = Point(1, 2)
    p₂ = Point(4, 5)
    ts *= @scoredtest p₁ + p₂ == Point(5, 7) name="p + q"
end

printsummary(maints)

If ::Point is undefined, let-block throws error and printsummary is unreacheable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.