blob: f065a0a3029b805b8b4b472ebb632414f03d9125 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#! /bin/bash
#
# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
# Copyright (c) 2004, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2
function tempfilename() {
fn=$(date "+%s")
if [ ! -f ${fn}.tmp ] ; then
echo ${fn}.tmp
fi
}
function report_pass() {
printf "%-40s - passed\n" ${1}
}
function report_failure() {
printf "%-40s - FAILED!\n" ${1}
}
function assert_samefile() {
diff $2 $3 && report_pass $1 || report_failure $1
}
function assert_eq() {
if [ $2 -eq $3 ] ; then
report_pass $1
else
printf "FAIL: $2 ! -eq $3\n"
report_failure $1
fi
}
function assert_ge() {
if [ $2 -ge $3 ] ; then
report_pass $1
else
printf "FAIL: $2 ! -ge $3\n"
report_failure $1
fi
}
function assert_exists() {
if [ -f $2 ] ; then
report_pass $1
else
printf "FAIL: $2 does not exist\n"
report_failure $1
fi
}
|