1 | # $Id: $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild - testcase for the functions.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2006-2007 knut st. osmundsen <[email protected]>
|
---|
7 | #
|
---|
8 | #
|
---|
9 | # This file is part of kLdr.
|
---|
10 | #
|
---|
11 | # kLdr 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 2 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kLdr 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.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kLdr; if not, write to the Free Software
|
---|
23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | #
|
---|
25 | #
|
---|
26 |
|
---|
27 | DEPTH = ../..
|
---|
28 | include $(PATH_KBUILD)/header.kmk
|
---|
29 |
|
---|
30 | ifneq ($(not 1),)
|
---|
31 | $(error The 'not' function is missing)
|
---|
32 | endif
|
---|
33 | ifneq ($(eq 1,1),1)
|
---|
34 | $(error The 'eq' function is missing)
|
---|
35 | endif
|
---|
36 |
|
---|
37 | ASSERT1 = $(if $(not $(eq $(STACK1),$(1))),$(error failure: STACK1:='$(STACK1)' expected='$(1)'))
|
---|
38 | $(call stack-push,STACK1,1)
|
---|
39 | $(call ASSERT,1)
|
---|
40 | $(call stack-push,STACK1,2)
|
---|
41 | $(call ASSERT,1 2)
|
---|
42 | $(call stack-push,STACK1,3)
|
---|
43 | $(call ASSERT,1 2 3)
|
---|
44 | $(call stack-push,STACK1,4)
|
---|
45 | $(call ASSERT,1 2 3 4)
|
---|
46 | $(call stack-push,STACK1,5)
|
---|
47 | $(call ASSERT,1 2 3 4 5)
|
---|
48 | $(call stack-popv,STACK1)
|
---|
49 | $(call ASSERT,1 2 3 4)
|
---|
50 | $(call stack-push,STACK1,5)
|
---|
51 | $(call ASSERT,1 2 3 4 5)
|
---|
52 | $(call stack-popv,STACK1)
|
---|
53 | $(call ASSERT,1 2 3 4)
|
---|
54 | $(call stack-popv,STACK1)
|
---|
55 | $(call ASSERT,1 2 3)
|
---|
56 | $(call stack-push,STACK1,4)
|
---|
57 | $(call ASSERT,1 2 3 4)
|
---|
58 | $(call stack-push,STACK1,5)
|
---|
59 | $(call ASSERT,1 2 3 4 5)
|
---|
60 | top := $(call stack-top,STACK1)
|
---|
61 | $(if $(not $(eq $(top),5)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='5'))
|
---|
62 | $(call ASSERT,1 2 3 4 5)
|
---|
63 | top := $(call stack-pop,STACK1)
|
---|
64 | $(if $(not $(eq $(top),5)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='5'))
|
---|
65 | $(call ASSERT,1 2 3 4)
|
---|
66 | top := $(call stack-pop,STACK1)
|
---|
67 | $(if $(not $(eq $(top),4)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='4'))
|
---|
68 | $(call ASSERT,1 2 3)
|
---|
69 | top := $(call stack-pop,STACK1)
|
---|
70 | $(if $(not $(eq $(top),3)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='3'))
|
---|
71 | $(call ASSERT,1 2)
|
---|
72 | top := $(call stack-pop,STACK1)
|
---|
73 | $(if $(not $(eq $(top),2)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='2'))
|
---|
74 | $(call ASSERT,1)
|
---|
75 | top := $(call stack-top,STACK1)
|
---|
76 | $(if $(not $(eq $(top),1)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='1'))
|
---|
77 | $(call ASSERT,1)
|
---|
78 | top := $(call stack-pop,STACK1)
|
---|
79 | $(if $(not $(eq $(top),1)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected='1'))
|
---|
80 | $(call ASSERT,)
|
---|
81 | top := $(call stack-pop,STACK1)
|
---|
82 | $(if $(not $(eq $(top),)),$(error failure STACK1:='$(STACK1)' top:='$(top)' expected=''))
|
---|
83 | $(call ASSERT,)
|
---|
84 |
|
---|
85 | all_recursive:
|
---|
86 | $(ECHO) The stack works.$(STACK1)
|
---|