Git Product home page Git Product logo

testgenerator's Introduction

testGenerator

Pythonコードをシンボリック実行により静的解析し、コード内のすべてのIfブロックに対するテスケースを生成するプログラムです。 シンボリック実行によってIfブロックへの到達制約をSMT問題に落としこみ、SMTソルバZ3によるテストケースの生成を行っています。

実行例

以下のようにif文を含んだ簡単なプログラムを入力します。

if __name__ == "__main__":
    sample = """
if a > 0:
    if b < 2 & c > 3:
        pass
        if d == 2:
            if e == 2:
                pass
        if e == 2:
            pass
        if f == 2:
            pass
"""

テスト例が生成されました。

[~/testGenerator]> python app.py
sat: ((a > 0)) & (((b < 2) & (c > 3)) & (((d == 2)) & ((e == 2))))
testcase: [c = 4, b = 1, a = 1, e = 2, d = 2]

sat: ((a > 0)) & (((b < 2) & (c > 3)) & ((d == 2)))
testcase: [c = 4, b = 1, a = 1, d = 2]

sat: ((a > 0)) & (((b < 2) & (c > 3)) & ((e == 2)))
testcase: [c = 4, b = 1, a = 1, e = 2]

sat: ((a > 0)) & (((b < 2) & (c > 3)) & ((f == 2)))
testcase: [a = 1, c = 4, b = 1, f = 2]

sat: ((a > 0)) & ((b < 2) & (c > 3))
testcase: [c = 4, b = 1, a = 1]

sat: (a > 0)
testcase: [a = 1]

実行例2

以下のように到達不可能なifブロックを入力します。

if __name__ == "__main__":
    sample = """
if a > 100 & a < 100:
    pass
"""

以下のように、unsatと出力されます。

[~/testGenerator]> python app.py
unsat: (a > 100) & (a < 100)

testgenerator's People

Contributors

kawa1290 avatar

Watchers

 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.