Documentation
/*
==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--

Dia-Files

Copyright (C) 2019-2025  Anonymous

There are several releases over multiple years,
they are listed as ranges, such as: "2019-2025".

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--
*/

#![cfg(test)]

use {
    crate::Result,
    super::{FilePermissions, Permissions, RawPermission},
};

#[test]
fn tests() -> Result<()> {
    for p in [
        Permissions::None, Permissions::Read, Permissions::ReadWrite, Permissions::ReadWriteExecute, Permissions::Write,
        Permissions::WriteExecute,
    ] {
        for (user, group, others) in [
            (p, Permissions::None, Permissions::None),
            (Permissions::None, p, Permissions::None),
            (Permissions::None, Permissions::None, p),
            (p, p, Permissions::None),
            (p, Permissions::None, p),
            (Permissions::None, p, p),
            (p, p, p),
        ] {
            let file_permissions = FilePermissions::new(user, group, others);
            assert_eq!(FilePermissions::try_from(RawPermission::from(file_permissions))?, file_permissions);
        }
    }

    Ok(())
}