
include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
unset (errors)

set(output "$<PATH:HAS_ROOT_NAME,/a/b>")
if (output)
  list (APPEND errors "ROOT_NAME: '/a/b' has root name")
endif()
set(output "$<PATH:HAS_ROOT_DIRECTORY,/a/b>")
if (NOT output)
  list (APPEND errors "ROOT_DIRECTORY: '/a/b' does not have root directory")
endif()
set(output "$<PATH:HAS_ROOT_PATH,/a/b>")
if (NOT output)
  list (APPEND errors "ROOT_PATH: '/a/b' does not have root path")
endif()

set(output "$<PATH:HAS_ROOT_PATH,a/b>")
if (output)
  list (APPEND errors "ROOT_PATH: 'a/b' has root path")
endif()

set(output "$<PATH:HAS_FILENAME,/a/b>")
if (NOT output)
  list (APPEND errors "FILENAME: '/a/b' does not have filename")
endif()
set(output "$<PATH:HAS_FILENAME,a.b>")
if (NOT output)
  list (APPEND errors "FILENAME: 'a.b' does not have filename")
endif()
set(output "$<PATH:HAS_FILENAME,/a/b/>")
if (output)
  list (APPEND errors "FILENAME: '/a/b/' has filename")
endif()
set(output "$<PATH:HAS_FILENAME,/>")
if (output)
  list (APPEND errors "FILENAME: '/' has filename")
endif()

set(output "$<PATH:HAS_STEM,/a/b>")
if (NOT output)
  list (APPEND errors "STEM: '/a/b' does not have stem")
endif()
set(output "$<PATH:HAS_STEM,a.b>")
if (NOT output)
  list (APPEND errors "STEM: 'a.b' does not have stem")
endif()
set(output "$<PATH:HAS_STEM,.a>")
if (NOT output)
  list (APPEND errors "STEM: '.a'} does not have stem")
endif()
set(output "$<PATH:HAS_STEM,/a/>")
if (output)
  list (APPEND errors "STEM: '/a/' has stem")
endif()
set(output "$<PATH:HAS_STEM,/>")
if (output)
  list (APPEND errors "STEM: '/' has stem")
endif()

set(output "$<PATH:HAS_EXTENSION,/a/b.c>")
if (NOT output)
  list (APPEND errors "EXTENSION: '/a/b.c' does not have extension")
endif()
set(output "$<PATH:HAS_EXTENSION,b.c>")
if (NOT output)
  list (APPEND errors "EXTENSION: 'b.c' does not have extension")
endif()
set(output "$<PATH:HAS_EXTENSION,/.a>")
if (output)
  list (APPEND errors "EXTENSION: '/.a' has extension")
endif()
set(output "$<PATH:HAS_EXTENSION,/a/>")
if (output)
  list (APPEND errors "EXTENSION: '/a/' has extension")
endif()
set(output "$<PATH:HAS_EXTENSION,/>")
if (output)
  list (APPEND errors "EXTENSION: '/' has extension")
endif()

set(output "$<PATH:HAS_RELATIVE_PART,/a/b>")
if (NOT output)
  list (APPEND errors "RELATIVE_PART: '/a/b' does not have relative part")
endif()
set(output "$<PATH:HAS_RELATIVE_PART,/>")
if (output)
  list (APPEND errors "RELATIVE_PART: '/' has relative part")
endif()

set(output "$<PATH:HAS_PARENT_PATH,/a/b>")
if (NOT output)
  list (APPEND errors "PARENT_PATH: '/a/b' does not have parent path")
endif()
set(output "$<PATH:HAS_PARENT_PATH,/>")
if (NOT output)
  list (APPEND errors "PARENT_PATH: '/' does not have parent path")
endif()
set(output "$<PATH:HAS_PARENT_PATH,a>")
if (output)
  list (APPEND errors "PARENT_PATH: 'a' has parent path")
endif()

if (WIN32)
  set(output "$<PATH:HAS_ROOT_NAME,c:/a/b>")
  if (NOT output)
    list (APPEND errors "ROOT_NAME: 'c:/a/b' does not have root name")
  endif()
  set(output "$<PATH:HAS_ROOT_DIRECTORY,c:/a/b>")
  if (NOT output)
    list (APPEND errors "ROOT_DIRECTORY: 'c:/a/b' does not have root directory")
  endif()
  set(output "$<PATH:HAS_ROOT_PATH,c:/a/b>")
  if (NOT output)
    list (APPEND errors "ROOT_PATH: 'c:/a/b' does not have root path")
  endif()

  set(output "$<PATH:HAS_ROOT_NAME,c:a/b>")
  if (NOT output)
    list (APPEND errors "ROOT_NAME: 'c:a/b' does not have root name")
  endif()
  set(output "$<PATH:HAS_ROOT_DIRECTORY,c:a/b>")
  if (output)
    list (APPEND errors "ROOT_DIRECTORY: 'c:a/b' has root directory")
  endif()
  set(output "$<PATH:HAS_ROOT_PATH,c:a/b>")
  if (NOT output)
    list (APPEND errors "ROOT_PATH: 'c:a/b' does not have root path")
  endif()

  set(output "$<PATH:HAS_ROOT_NAME,//host/b>")
  if (NOT output)
    list (APPEND errors "ROOT_NAME: '//host/b' does not have root name")
  endif()
  set(output "$<PATH:HAS_ROOT_DIRECTORY,//host/b>")
  if (NOT output)
    list (APPEND errors "ROOT_DIRECTORY: '//host/b' does not have root directory")
  endif()
  set(output "$<PATH:HAS_ROOT_PATH,//host/b>")
  if (NOT output)
    list (APPEND errors "ROOT_PATH: '//host/b' does not have root path")
  endif()

  set(output "$<PATH:HAS_ROOT_NAME,//host>")
  if (NOT output)
    list (APPEND errors "ROOT_NAME: '//host' does not have root name")
  endif()
  set(output "$<PATH:HAS_ROOT_DIRECTORY,//host>")
  if (output)
    list (APPEND errors "ROOT_DIRECTORY: '//host' has root directory")
  endif()
  set(output "$<PATH:HAS_ROOT_PATH,//host>")
  if (NOT output)
    list (APPEND errors "ROOT_PATH: '//host' does not have root path")
  endif()

  set(output "$<PATH:HAS_RELATIVE_PART,c:/a/b>")
  if (NOT output)
    list (APPEND errors "RELATIVE_PART: 'c:/a/b' does not have relative part")
  endif()

  set(output "$<PATH:HAS_RELATIVE_PART,c:a/b>")
  if (NOT output)
    list (APPEND errors "RELATIVE_PART: 'c:a/b' does not have relative part")
  endif()

  set(output "$<PATH:HAS_RELATIVE_PART,//host/b>")
  if (NOT output)
    list (APPEND errors "RELATIVE_PART: '//host/b' does not have relative part")
  endif()

  set(output "$<PATH:HAS_PARENT_PATH,c:/a/b>")
  if (NOT output)
    list (APPEND errors "PARENT_PATH: 'c:/a/b' does not have parent path")
  endif()

  set(output "$<PATH:HAS_PARENT_PATH,c:/>")
  if (NOT output)
    list (APPEND errors "PARENT_PATH: 'c:/' does not have parent path")
  endif()

  set(output "$<PATH:HAS_PARENT_PATH,c:>")
  if (NOT output)
    list (APPEND errors "PARENT_PATH: 'c:' does not have parent path")
  endif()

  set(output "$<PATH:HAS_PARENT_PATH,//host/>")
  if (NOT output)
    list (APPEND errors "PARENT_PATH: '//host/' does not have parent path")
  endif()

  set(output "$<PATH:HAS_PARENT_PATH,//host>")
  if (NOT output)
    list (APPEND errors "PARENT_PATH: '//host' does not have parent path")
  endif()
endif()


check_errors ("PATH:HAS..." ${errors})
