//
// Automated Testing Framework (atf)
//
// Copyright (c) 2007 The NetBSD Foundation, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
//
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
extern "C" {
}
#include <fstream>
#include <cerrno>
#include <cstdio>
#include "../macros.hpp"
#include "exceptions.hpp"
#include "fs.hpp"
// ------------------------------------------------------------------------
// Auxiliary functions.
// ------------------------------------------------------------------------
static
void
create_files(void)
{
// TODO: Should create all other file types (blk, chr, fifo, lnk, sock)
// and test for them... but the underlying file system may not support
// most of these. Specially as we are working on /tmp, which can be
// mounted with flags such as "nodev". See how to deal with this
// situation.
}
// ------------------------------------------------------------------------
// Test cases for the "path" class.
// ------------------------------------------------------------------------
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
"absolute one");
}
{
create_files();
{
const path p(".");
}
{
}
}
{
}
{
create_files();
}
// ------------------------------------------------------------------------
// Test cases for the "directory" class.
// ------------------------------------------------------------------------
{
"the contents of a directory");
}
{
create_files();
}
{
"directory are valid");
}
{
create_files();
{
}
{
}
}
{
}
{
create_files();
}
// ------------------------------------------------------------------------
// Test cases for the "file_info" class.
// ------------------------------------------------------------------------
{
}
{
create_files();
{
}
{
}
}
{
"permissions");
}
{
path p("file");
{ \
}
perms(false, false, false, false, false, false, false, false, false);
perms(false, false, false, false, false, false, false, false, true);
perms(false, false, false, false, false, true, false, false, false);
perms(false, false, true, false, false, false, false, false, false);
perms(false, false, false, false, false, false, false, true, false);
perms(false, false, false, false, true, false, false, false, false);
perms(false, true, false, false, false, false, false, false, false);
perms(false, false, false, false, false, false, true, false, false);
perms(false, false, false, true, false, false, false, false, false);
perms(true, false, false, false, false, false, false, false, false);
perms(true, true, false, true, false, false, true, false, false);
perms(true, true, true, true, false, true, true, false, true);
perms(true, true, true, true, true, true, true, true, true);
}
// ------------------------------------------------------------------------
// Test cases for the free functions.
// ------------------------------------------------------------------------
{
}
{
create_files();
}
{
}
{
create_files();
}
{
}
{
create_files();
}
// ------------------------------------------------------------------------
// Main.
// ------------------------------------------------------------------------
{
// Add the tests for the "path" class.
// Add the tests for the "file_info" class.
// Add the tests for the "directory" class.
// Add the tests for the free functions.
}