kmk: strlcpy build fix for windows.
[kbuild-mirror.git] / src / kmk / testcase-stack.kmk
blob8bd12230c91482f5aea92fcb64f7bc5f9476cdde
1 # $Id$
2 ## @file
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/>
26 DEPTH = ../..
27 include $(PATH_KBUILD)/header.kmk
29 ifneq ($(not 1),)
30 $(error The 'not' function is missing)
31 endif
32 ifneq ($(eq 1,1),1)
33 $(error The 'eq' function is missing)
34 endif
36 ASSERT1 = $(if $(not $(eq $(STACK1),$(1))),$(error failure: STACK1:='$(STACK1)' expected='$(1)'))
37 $(call stack-push,STACK1,1)
38 $(call ASSERT,1)
39 $(call stack-push,STACK1,2)
40 $(call ASSERT,1 2)
41 $(call stack-push,STACK1,3)
42 $(call ASSERT,1 2 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)
54 $(call ASSERT,1 2 3)
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'))
67 $(call ASSERT,1 2 3)
68 top := $(call stack-pop,STACK1)
69 $(if $(not $(eq $(top),3)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='3'))
70 $(call ASSERT,1 2)
71 top := $(call stack-pop,STACK1)
72 $(if $(not $(eq $(top),2)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='2'))
73 $(call ASSERT,1)
74 top := $(call stack-top,STACK1)
75 $(if $(not $(eq $(top),1)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='1'))
76 $(call ASSERT,1)
77 top := $(call stack-pop,STACK1)
78 $(if $(not $(eq $(top),1)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='1'))
79 $(call ASSERT,)
80 top := $(call stack-pop,STACK1)
81 $(if $(not $(eq $(top),)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected=''))
82 $(call ASSERT,)
84 all_recursive:
85 $(ECHO) The stack works.$(STACK1)