<commit_before>﻿using Cosmos.Debug.Kernel;
using Cosmos.HAL.BlockDevice;
using Cosmos.System.FileSystem;
using Cosmos.System.FileSystem.FAT;
using Cosmos.System.FileSystem.Listing;
using Cosmos.System.FileSystem.VFS;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;

namespace Cosmos.System.Tests
{
    class VFSManagerTest
    {

        [SetUp]
        public void Setup()
        {
            DebuggerFactory.WriteToConsole = true;
            var xDevice = new TestBlockDevice();
            var xPartition = new Partition(xDevice, 0, xDevice.BlockCount);
            BlockDevice.Devices.Clear();
            BlockDevice.Devices.Add(xPartition);
            VFSManager.RegisterVFS(new CosmosVFS(), true);
        }

        [Test]
        public void Test_Disk_Manager()
        {
            const string root = @"0:\";
            long initialSize = VFSManager.GetTotalSize(root);
            VFSManager.Format(root, "FAT32", true);
            Assert.AreEqual(initialSize, VFSManager.GetAvailableFreeSpace(root));
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateFile(root + "\\test.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "\\test.txt"));
        }

        [Test]
        public void Test_Disk_Manager_Reformating()
        {
            const string root = @"0:\";
            long initialSize = VFSManager.GetTotalSize(root);
            VFSManager.Format(root, "FAT32", true);
            Assert.AreEqual(initialSize, VFSManager.GetAvailableFreeSpace(root));
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateFile(root + "\\test.txt");
            VFSManager.CreateFile(root + "\\test1.txt");
            VFSManager.CreateFile(root + "\\test2.txt");
            VFSManager.CreateFile(root + "\\test3.txt");
            VFSManager.CreateFile(root + "\\test4.txt");
            VFSManager.CreateDirectory(root + "\\SubDir");
            VFSManager.CreateFile(root + "\\SubDir\\file.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "\\SubDir\\file.txt"));
            List<DirectoryEntry> lists = VFSManager.GetDirectoryListing(root);
            Assert.AreEqual(6, lists.Count);
            Assert.AreEqual(DirectoryEntryTypeEnum.File, lists[0].mEntryType);
            Assert.AreEqual(DirectoryEntryTypeEnum.Directory, lists[5].mEntryType);
            VFSManager.Format(root, "FAT32", true);
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateDirectory(root + "\\dir");
            VFSManager.CreateFile(root + "\\newfile.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "\\newfile.txt"));
            Assert.AreEqual(2, VFSManager.GetDirectoryListing(root).Count);
        }

        [Test]
        public void Test_Disk_Manager_Reformating_First_Directories()
        {
            const string root = @"0:\";
            long initialSize = VFSManager.GetTotalSize(root);
            VFSManager.Format(root, "FAT32", true);
            Assert.AreEqual(initialSize, VFSManager.GetAvailableFreeSpace(root));
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateDirectory(root + "\\SubDir");
            VFSManager.CreateFile(root + "\\SubDir\\filet.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "\\SubDir\\filet.txt"));
            Assert.AreEqual(1, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.Format(root, "FAT32", true);
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateDirectory(root + "\\dir");
            Assert.AreEqual(1, VFSManager.GetDirectoryListing(root).Count);
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root + "\\dir").Count);
        }
    }
}<commit_msg>Replace 0:\ by 0 in VFSManagerTest<commit_after>﻿using Cosmos.Debug.Kernel;
using Cosmos.HAL.BlockDevice;
using Cosmos.System.FileSystem;
using Cosmos.System.FileSystem.FAT;
using Cosmos.System.FileSystem.Listing;
using Cosmos.System.FileSystem.VFS;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;

namespace Cosmos.System.Tests
{
    class VFSManagerTest
    {

        [SetUp]
        public void Setup()
        {
            DebuggerFactory.WriteToConsole = true;
            var xDevice = new TestBlockDevice();
            var xPartition = new Partition(xDevice, 0, xDevice.BlockCount);
            BlockDevice.Devices.Clear();
            BlockDevice.Devices.Add(xPartition);
            VFSManager.RegisterVFS(new CosmosVFS(), true);
        }

        [Test]
        public void Test_Disk_Manager()
        {
            const string root = @"0:\";
            long initialSize = VFSManager.GetTotalSize(root);
            VFSManager.Format("0", "FAT32", true);
            Assert.AreEqual(initialSize, VFSManager.GetAvailableFreeSpace(root));
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateFile(root + "\\test.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "\\test.txt"));
        }

        [Test]
        public void Test_Disk_Manager_Reformating()
        {
            const string root = @"0:\";
            long initialSize = VFSManager.GetTotalSize(root);
            VFSManager.Format("0", "FAT32", true);
            Assert.AreEqual(initialSize, VFSManager.GetAvailableFreeSpace(root));
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateFile(root + "\\test.txt");
            VFSManager.CreateFile(root + "\\test1.txt");
            VFSManager.CreateFile(root + "\\test2.txt");
            VFSManager.CreateFile(root + "\\test3.txt");
            VFSManager.CreateFile(root + "\\test4.txt");
            VFSManager.CreateDirectory(root + "\\SubDir");
            VFSManager.CreateFile(root + "\\SubDir\\file.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "\\SubDir\\file.txt"));
            List<DirectoryEntry> lists = VFSManager.GetDirectoryListing(root);
            Assert.AreEqual(6, lists.Count);
            Assert.AreEqual(DirectoryEntryTypeEnum.File, lists[0].mEntryType);
            Assert.AreEqual(DirectoryEntryTypeEnum.Directory, lists[5].mEntryType);
            VFSManager.Format("0", "FAT32", true);
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateDirectory(root + "\\dir");
            VFSManager.CreateFile(root + "\\newfile.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "\\newfile.txt"));
            Assert.AreEqual(2, VFSManager.GetDirectoryListing(root).Count);
        }

        [Test]
        public void Test_Disk_Manager_Reformating_First_Directories()
        {
            const string root = @"0:\";
            long initialSize = VFSManager.GetTotalSize(root);
            VFSManager.Format("0", "FAT32", true);
            Assert.AreEqual(initialSize, VFSManager.GetAvailableFreeSpace(root));
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateDirectory(root + "\\SubDir");
            VFSManager.CreateFile(root + "\\SubDir\\filet.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "\\SubDir\\filet.txt"));
            Assert.AreEqual(1, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.Format("0", "FAT32", true);
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateDirectory(root + "\\dir");
            Assert.AreEqual(1, VFSManager.GetDirectoryListing(root).Count);
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root + "\\dir").Count);
        }
    }
}
{'fraction_non_alphanumeric': 0.12854587273191925, 'fraction_numerical': 0.00856120623562484, 'mean_word_length': 2.533634311512415, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '358769', 'n_tokens_mistral': 2306, 'n_tokens_neox': 2240, 'n_words': 327}