3 # kBuild - testcase for the functions.
7 # Copyright (c) 2007-2008 knut st. osmundsen <bird-src-spam@anduin.net>
9 # This file is part of kBuild.
11 # kBuild is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or
14 # (at your option) any later version.
16 # kBuild is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with kBuild. If not, see <http://www.gnu.org/licenses/>
27 include $(PATH_KBUILD
)/header.kmk
30 $(error The
'not' function is missing
)
33 $(error The
'eq' function is missing
)
36 ASSERT1
= $(if
$(not
$(eq
$(STACK1
),$(1))),$(error failure
: STACK1
:='$(STACK1)' expected
='$(1)'))
37 $(call stack-push
,STACK1
,1)
39 $(call stack-push
,STACK1
,2)
41 $(call stack-push
,STACK1
,3)
43 $(call stack-push
,STACK1
,4)
44 $(call ASSERT
,1 2 3 4)
45 $(call stack-push
,STACK1
,5)
46 $(call ASSERT
,1 2 3 4 5)
47 $(call stack-popv
,STACK1
)
48 $(call ASSERT
,1 2 3 4)
49 $(call stack-push
,STACK1
,5)
50 $(call ASSERT
,1 2 3 4 5)
51 $(call stack-popv
,STACK1
)
52 $(call ASSERT
,1 2 3 4)
53 $(call stack-popv
,STACK1
)
55 $(call stack-push
,STACK1
,4)
56 $(call ASSERT
,1 2 3 4)
57 $(call stack-push
,STACK1
,5)
58 $(call ASSERT
,1 2 3 4 5)
59 top
:= $(call stack-top
,STACK1
)
60 $(if
$(not
$(eq
$(top
),5)),$(error failure STACK1
:='$(STACK1)' top
:='$(top)' expected
='5'))
61 $(call ASSERT
,1 2 3 4 5)
62 top
:= $(call stack-pop
,STACK1
)
63 $(if
$(not
$(eq
$(top
),5)),$(error failure STACK1
:='$(STACK1)' top
:='$(top)' expected
='5'))
64 $(call ASSERT
,1 2 3 4)
65 top
:= $(call stack-pop
,STACK1
)
66 $(if
$(not
$(eq
$(top
),4)),$(error failure STACK1
:='$(STACK1)' top
:='$(top)' expected
='4'))
68 top
:= $(call stack-pop
,STACK1
)
69 $(if
$(not
$(eq
$(top
),3)),$(error failure STACK1
:='$(STACK1)' top
:='$(top)' expected
='3'))
71 top
:= $(call stack-pop
,STACK1
)
72 $(if
$(not
$(eq
$(top
),2)),$(error failure STACK1
:='$(STACK1)' top
:='$(top)' expected
='2'))
74 top
:= $(call stack-top
,STACK1
)
75 $(if
$(not
$(eq
$(top
),1)),$(error failure STACK1
:='$(STACK1)' top
:='$(top)' expected
='1'))
77 top
:= $(call stack-pop
,STACK1
)
78 $(if
$(not
$(eq
$(top
),1)),$(error failure STACK1
:='$(STACK1)' top
:='$(top)' expected
='1'))
80 top
:= $(call stack-pop
,STACK1
)
81 $(if
$(not
$(eq
$(top
),)),$(error failure STACK1
:='$(STACK1)' top
:='$(top)' expected
=''))
85 $(ECHO
) The stack works.
$(STACK1
)