PuzzleD

D Interface to libpuzzle
git clone git://xatko.vsos.ethz.ch/PuzzleD.git
Log | Files | Refs

commit 1518875b5e1dbbcc415735b8f1a5b7691e229523
parent fa4d569b330383fba7787821ac17ae923819afae
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Thu, 27 Aug 2015 01:16:40 +0200

Do some contracttests

Diffstat:
puzzle.d | 18+++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/puzzle.d b/puzzle.d @@ -118,7 +118,11 @@ struct Puzzle{ struct DVec{ PuzzleDvec vec; PuzzleContext *ctx; - this(PuzzleContext *ctx){ + this(PuzzleContext *ctx) + in{ + assert(ctx.valid(), "Context invalid"); + } + body{ this.ctx=ctx; puzzle_init_dvec(ctx,&vec); } @@ -143,7 +147,11 @@ struct DVec{ struct CVec{ PuzzleCvec vec; PuzzleContext *ctx; - this(ref CVec_Compressed c){ + this(ref CVec_Compressed c) + in{ + assert(ctx.valid(), "Context invalid"); + } + body{ this(c.ctx); puzzle_uncompress_cvec(ctx, &c.vec, &vec); } @@ -177,7 +185,11 @@ struct CVec_Compressed{ this(c.ctx); puzzle_compress_cvec(ctx, &vec, &c.vec); } - this(PuzzleContext *ctx){ + this(PuzzleContext *ctx) + in{ + assert(ctx.valid(), "Context invalid"); + } + body{ this.ctx=ctx; puzzle_init_compressed_cvec(ctx,&vec); }