Git Product home page Git Product logo

clematis's Introduction

Clematis

Basic ZScript unit test framework for GZDoom
Inspired by Lilac by Chesko

Documentation

Making Test Suites

class ClematisExample : Clematis {
    override
    void TestSuites() {
        //////////////////
        // Assert-style //
        //////////////////

        Describe('Testing Player Stats');
            It('MaxHealth', AssertEval(20, '<', 100), LOG_Warning);
            It('Math', AssertEval(1+1, '==', 2), LOG_Fatal);
            It('Woot', Assert(true), LOG_Fatal);
        EndDescribe();

        let x = new('Object');
        let y = new('Object');

        Describe('Testing Math');
            It('Calculus', AssertFalse(0*1!=0), LOG_Error);
            It('Math', AssertSame(x, y, "Custom error message using values (%p and %p)"), LOG_Warning);
        EndDescribe();

        //////////////////
        // Expect-style //
        //////////////////

        Describe('Testing 123');
            It('Lorum', ExpectNum(12).to.be.lessThan().thisNum(30), LOG_Error);
            It('Ipsum', ExpectObj(new('Object')).to.be.instance().of.thisCls('Object'), LOG_Error);
            It('Call explicit matchers which can be added', ExpectNum(0, 'not >=').thisNum(42), LOG_Info);
        EndDescribe();
    }
}

Override TestSuites and put in your own! Suites are started with Describe and end with EndDescribe

How to Run Tests

On Instantiation

Tests run on instantiation by default, which can be disabled by overriding Init()

Factory Method
Clematis.Create('ClematisExample');
Network Event
EventHandler.SendNetworkEvent('test:ClematisExample');
Console Command
netevent test:ClematisExample

On Method Call

Clematis Tester=Clematis.Create('ClematisExample');
Tester.Run();

License

Clematis is under the BSD 3-Clause License

clematis's People

Contributors

mmaulwurff avatar zippeykeys12 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mmaulwurff

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.