Deleted Added
full compact
t_factor.sh (272458) t_factor.sh (278616)
1# $NetBSD: t_factor.sh,v 1.7 2010/11/19 12:31:36 pgoyette Exp $
2#
3# Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 13 unchanged lines hidden (view full) ---

22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25# POSSIBILITY OF SUCH DAMAGE.
26#
27
28expect() {
29 echo "${2}" >expout
1# $NetBSD: t_factor.sh,v 1.7 2010/11/19 12:31:36 pgoyette Exp $
2#
3# Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 13 unchanged lines hidden (view full) ---

22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25# POSSIBILITY OF SUCH DAMAGE.
26#
27
28expect() {
29 echo "${2}" >expout
30 atf_check -s eq:0 -o file:expout -e empty /usr/games/factor ${1}
30 atf_check -s eq:0 -o file:expout -e empty /usr/bin/factor ${1}
31}
32
33atf_test_case overflow
34overflow_head() {
35 atf_set "descr" "Tests for overflow conditions"
31}
32
33atf_test_case overflow
34overflow_head() {
35 atf_set "descr" "Tests for overflow conditions"
36 atf_set "require.progs" "/usr/games/factor"
36 atf_set "require.progs" "/usr/bin/factor"
37}
38overflow_body() {
39 expect '8675309' '8675309: 8675309'
40 expect '6172538568' '6172538568: 2 2 2 3 7 17 2161253'
41}
42
43atf_test_case loop
44loop_head() {
45 atf_set "descr" "Tests some cases that once locked the program" \
46 "in an infinite loop"
37}
38overflow_body() {
39 expect '8675309' '8675309: 8675309'
40 expect '6172538568' '6172538568: 2 2 2 3 7 17 2161253'
41}
42
43atf_test_case loop
44loop_head() {
45 atf_set "descr" "Tests some cases that once locked the program" \
46 "in an infinite loop"
47 atf_set "require.progs" "/usr/games/factor"
47 atf_set "require.progs" "/usr/bin/factor"
48}
49loop_body() {
50 expect '99999999999991' '99999999999991: 7 13 769231 1428571'
51 expect '2147483647111311' '2147483647111311: 3 3 3 131 607148331103'
52}
53
54atf_init_test_cases()
55{
56 atf_add_test_case overflow
57 atf_add_test_case loop
58}
48}
49loop_body() {
50 expect '99999999999991' '99999999999991: 7 13 769231 1428571'
51 expect '2147483647111311' '2147483647111311: 3 3 3 131 607148331103'
52}
53
54atf_init_test_cases()
55{
56 atf_add_test_case overflow
57 atf_add_test_case loop
58}