/*
 *  test_dirname.sli
 *
 *  This file is part of NEST.
 *
 *  Copyright (C) 2004 The NEST Initiative
 *
 *  NEST is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  NEST is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NEST.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

/* BeginDocumentation
   Name: testsuite::test_dirname - tests dirname from filesystem.sli for POSIX conformance

   Synopsis: (test_dirname) run

   Description:

   This test runs the dirname test cases from coreutils distribution.

   SeeAlso: dirname

   FirstVersion: November 2012
   Author: Yury V. Zaytsev
 */

/unittest (7488) require
/unittest using

<<

  % Test cases that are part of dirname.pl
  /a  [ (d/f)         (d)    ]
  /b  [ (/d/f)        (/d)   ]
  /c  [ (d/f/)        (d)    ]
  /d  [ (d/f//)       (d)    ]
  /e  [ (f)           (.)    ]
  /f  [ (/)           (/)    ]
  /g  [ (//)          (/)    ]
  /h  [ (///)         (/)    ]
  /i  [ (//a//)       (/)    ]
  /j  [ (///a///)     (/)    ]
  /k  [ (///a///b)    (///a) ]
  /l  [ (///a//b/)    (///a) ]
  /m  [ ()            (.)    ]

  % Not part of dirname.pl, taken from test-dirname.c
  /y  [ (.)           (.)    ]
  /z  [ (..)          (.)    ]

>>

{
  (Testing case ) rolld cvs join (...) join =
    arrayload pop exch
      dirname eq
        assert_or_die
} forall

endusing