GithubHelp home page GithubHelp logo

hopa's Introduction

Behaviour Driven Development for C.

hopa-core

hopa-core provides the structure for writing executable examples of how your code should behave, and an hopa command with tools to constrain which examples get run and tailor the output.

Install

echo alias hopa='./hopa/hopa/hopa' >> ~/.bashrc
source ~/.bashrc

Add in project

cd your_project
git clone [email protected]:DasRegal/hopa.git
hopa init

Basic Structure

Hopa uses the words "describe" and "it" so we can express concepts like a conversation:

"Describe a Modification"
"It must initialize correctly"
source("example_src/module_1.c")
{
    #include "../example_src/module_1.h"
    {
        describe("Modification")
        {
            it("must initialize correctly")
            {
                ModuleOneInit();
                
                ModuleOneGetState() to_eq(MOD_1_VAL);
            }
        }
    }
}

before_each block is called before each it block, and is intended for repetitive actions.

{
    before_each
    {
        printf("Hello\n");
    }

    it("...") {}
    it("...") {}
    it("...") {}
}

Result:

Hello
Hello
Hello

Nested Groups

You can also declare nested groups using the describe or context words:

{
    context("with no items")
    {
        it("behaves one way")
        {
            /*
            ...
            */
        }
    }

    context("with one item")
    {
        it("behaves another way")
        {
            /*
            ...
            */
        }
    }
}

The hopa Command

When you install the hopa-core , it installs the hopa script, which you'll use to run hopa. The hopa command comes with many useful options. Run hopa --help to see the complete list.

hopa's People

Contributors

dasregal avatar

Watchers

Lucian avatar  avatar

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.