1d1b06863SMark Murray#!/bin/sh 2d1b06863SMark Murray#- 3d1b06863SMark Murray# Copyright (c) 2013-2015 Mark R V Murray 4d1b06863SMark Murray# All rights reserved. 5d1b06863SMark Murray# 6d1b06863SMark Murray# Redistribution and use in source and binary forms, with or without 7d1b06863SMark Murray# modification, are permitted provided that the following conditions 8d1b06863SMark Murray# are met: 9d1b06863SMark Murray# 1. Redistributions of source code must retain the above copyright 10d1b06863SMark Murray# notice, this list of conditions and the following disclaimer 11d1b06863SMark Murray# in this position and unchanged. 12d1b06863SMark Murray# 2. Redistributions in binary form must reproduce the above copyright 13d1b06863SMark Murray# notice, this list of conditions and the following disclaimer in the 14d1b06863SMark Murray# documentation and/or other materials provided with the distribution. 15d1b06863SMark Murray# 16d1b06863SMark Murray# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17d1b06863SMark Murray# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18d1b06863SMark Murray# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19d1b06863SMark Murray# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20d1b06863SMark Murray# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21d1b06863SMark Murray# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22d1b06863SMark Murray# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23d1b06863SMark Murray# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24d1b06863SMark Murray# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25d1b06863SMark Murray# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26d1b06863SMark Murray# 2710cb2424SMark Murray# 2810cb2424SMark Murray# Basic script to build crude unit tests. 2910cb2424SMark Murray# 30*19fa89e9SMark Murray# Diff-reduction checking between fortuna and the other algorithm is done like so: 313aa77530SMark Murray# 32*19fa89e9SMark Murray# $ diff -u -B <(sed -e 's/random_other/random_wombat/g' \ 33*19fa89e9SMark Murray# -e 's/RANDOM_OTHER/RANDOM_WOMBAT/g' other_algorithm.c) \ 34*19fa89e9SMark Murray# <(sed -e 's/random_fortuna/random_wombat/g' \ 35*19fa89e9SMark Murray# -e 's/RANDOM_FORTUNA/RANDOM_WOMBAT/g' fortuna.c) | less 363aa77530SMark Murray# 37e866d8f0SMark Murraycc -g -O0 -pthread \ 3810cb2424SMark Murray -I../.. -lstdthreads -Wall \ 3910cb2424SMark Murray unit_test.c \ 40*19fa89e9SMark Murray other_algorithm.c \ 4110cb2424SMark Murray hash.c \ 4210cb2424SMark Murray ../../crypto/rijndael/rijndael-api-fst.c \ 4310cb2424SMark Murray ../../crypto/rijndael/rijndael-alg-fst.c \ 4410cb2424SMark Murray ../../crypto/sha2/sha256c.c \ 45d1b06863SMark Murray -lz \ 46*19fa89e9SMark Murray -o other_unit_test 47e866d8f0SMark Murraycc -g -O0 -pthread \ 4810cb2424SMark Murray -I../.. -lstdthreads -Wall \ 4910cb2424SMark Murray unit_test.c \ 5010cb2424SMark Murray fortuna.c \ 5110cb2424SMark Murray hash.c \ 5210cb2424SMark Murray ../../crypto/rijndael/rijndael-api-fst.c \ 5310cb2424SMark Murray ../../crypto/rijndael/rijndael-alg-fst.c \ 5410cb2424SMark Murray ../../crypto/sha2/sha256c.c \ 55d1b06863SMark Murray -lz \ 56*19fa89e9SMark Murray -o fortuna_unit_test 57