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
}
\ No newline at end of file
--- /dev/null
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_belongs() {
+ equery belongs $(which gcc) > ${tmpfile}
+
+ x=$(grep "gcc-config" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_belongs
+
+rm -f ${tmpfile}
\ No newline at end of file
--- /dev/null
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_check() {
+ equery check gcc > ${tmpfile}
+
+ x=$(grep "sys-devel/gcc" ${tmpfile} | wc -l)
+
+ assert_ge ${FUNCNAME} ${x} 1
+
+ x=$(egrep "[0-9]+ out of [0-9]+" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_check
+
+rm -f ${tmpfile}
\ No newline at end of file
--- /dev/null
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_depends() {
+# equery skel gcc > ${tmpfile}
+
+# x=$(grep "app-shells/bash" ${tmpfile} | wc -l)
+
+# assert_eq ${FUNCNAME} ${x} 1
+
+# x=$(grep "virtual/libc" ${tmpfile} | wc -l)
+# assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+#test_skel
+
+rm -f ${tmpfile}
\ No newline at end of file
--- /dev/null
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_depgraph() {
+ equery depgraph gcc > ${tmpfile}
+
+ x=$(grep "app-shells/bash" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+
+ x=$(grep "virtual/libc" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_depgraph
+
+rm -f ${tmpfile}
\ No newline at end of file
--- /dev/null
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_list() {
+ equery list > ${tmpfile}
+
+ pkgs=$(cat ${tmpfile} | wc -l)
+ x=$(grep "[I--]" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} ${pkgs} ${x]
+
+ x=$(grep "app-shells/bash" | wc -l)
+ assert_ge ${FUNCNAME} $x 1
+}
+
+test_list_installed() {
+ test_list
+}
+
+test_list_portage_tree() {
+ equery list -I -p > ${tmpfile}
+}
+
+test_list_overlay_tree() {
+ equery list -I -o > ${tmpfile}
+}
+
+# Run tests
+
+test_list
+
+rm -f ${tmpfile}
\ No newline at end of file
--- /dev/null
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_size() {
+ equery size gcc > ${tmpfile}
+
+ x=$(grep "sys-devel/gcc" ${tmpfile} | wc -l)
+
+ assert_ge ${FUNCNAME} ${x} 1
+
+ x=$(egrep "size\([0-9]+\)" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_size
+
+rm -f ${tmpfile}
\ No newline at end of file
--- /dev/null
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_uses() {
+ equery uses gcc > ${tmpfile}
+
+ x=$(grep "static" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+
+ x=$(cat ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 7
+}
+
+test_uses_all() {
+ equery uses -a uclibc > ${tmpfile}
+
+ x=$(grep "static" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} ${pkgs} ${x]
+
+ x=$(cat ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 5
+
+}
+
+# Run tests
+
+test_uses
+test_uses_all
+
+rm -f ${tmpfile}
\ No newline at end of file
--- /dev/null
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_which() {
+ file=$(equery which gcc)
+
+ assert_exists ${FUNCNAME} ${file}
+}
+
+# Run tests
+
+test_which
+
+rm -f ${tmpfile}
\ No newline at end of file