1 #
2 # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
246 endif
247
248 ifneq ($(call sequence, 4, 9), 4 5 6 7 8 9)
249 $(error Sequence 4, 9 should be "4 5 6 7 8 9", but was $(call sequence, 4, 9))
250 endif
251
252 ifneq ($(call sequence, 5, 15), 5 6 7 8 9 10 11 12 13 14 15)
253 $(error Sequence 5, 15 should be "5 6 7 8 9 10 11 12 13 14 15", \
254 but was $(call sequence, 5, 15))
255 endif
256
257 ################################################################################
258 # Test that PathList is safe when called multiple nested times.
259
260 PATHLIST_INPUT := foo bar baz
261
262 $(eval $(call assert-equals, \
263 $(call PathList, $(call PathList, $(PATHLIST_INPUT))), \
264 $(call PathList, $(PATHLIST_INPUT)), \
265 PathList call not safe for calling twice))
266
267 all: $(TEST_TARGETS)
|
1 #
2 # Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
246 endif
247
248 ifneq ($(call sequence, 4, 9), 4 5 6 7 8 9)
249 $(error Sequence 4, 9 should be "4 5 6 7 8 9", but was $(call sequence, 4, 9))
250 endif
251
252 ifneq ($(call sequence, 5, 15), 5 6 7 8 9 10 11 12 13 14 15)
253 $(error Sequence 5, 15 should be "5 6 7 8 9 10 11 12 13 14 15", \
254 but was $(call sequence, 5, 15))
255 endif
256
257 ################################################################################
258 # Test that PathList is safe when called multiple nested times.
259
260 PATHLIST_INPUT := foo bar baz
261
262 $(eval $(call assert-equals, \
263 $(call PathList, $(call PathList, $(PATHLIST_INPUT))), \
264 $(call PathList, $(PATHLIST_INPUT)), \
265 PathList call not safe for calling twice))
266
267 ################################################################################
268 # Test FindCommonPathPrefix
269
270 $(eval $(call assert-equals, \
271 $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \
272 /foo/bar, \
273 FindCommonPathPrefix, \
274 ))
275
276 $(eval $(call assert-equals, \
277 $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \
278 /foo/bar, \
279 FindCommonPathPrefix, \
280 ))
281
282 $(eval $(call assert-equals, \
283 $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \
284 /foo/bar, \
285 FindCommonPathPrefix, \
286 ))
287
288 $(eval $(call assert-equals, \
289 $(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \
290 foo/bar, \
291 FindCommonPathPrefix, \
292 ))
293
294 $(eval $(call assert-equals, \
295 $(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \
296 , \
297 FindCommonPathPrefix, \
298 ))
299
300 ################################################################################
301 # DirToDotDot
302
303 $(eval $(call assert-equals, \
304 $(call DirToDotDot, foo/bar/baz/), \
305 ../../.., \
306 DirToDotDot, \
307 ))
308
309 $(eval $(call assert-equals, \
310 $(call DirToDotDot, foo/bar), \
311 ../.., \
312 DirToDotDot, \
313 ))
314
315 $(eval $(call assert-equals, \
316 $(call DirToDotDot, /foo), \
317 .., \
318 DirToDotDot, \
319 ))
320
321 ################################################################################
322 # RelativePath
323
324 $(eval $(call assert-equals, \
325 $(call RelativePath, foo/bar/baz, foo/bar/banan), \
326 ../baz, \
327 RelativePath, \
328 ))
329
330 $(eval $(call assert-equals, \
331 $(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \
332 ../../baz/banan/kung, \
333 RelativePath, \
334 ))
335
336 $(eval $(call assert-equals, \
337 $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \
338 ../../baz/banan/kung, \
339 RelativePath, \
340 ))
341
342 ################################################################################
343
344 all: $(TEST_TARGETS)
|