<commit_before>﻿using System;
using DlibDotNet.Tests.Matrix;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DlibDotNet.Tests.Array2D
{

    [TestClass]
    public class Array2DTest : TestBase
    {

        [TestMethod]
        public void CreateArray2D()
        {
            var tests = new[]
            {
                new { Type = ImageTypes.RgbPixel,      ExpectResult = true},
                new { Type = ImageTypes.RgbAlphaPixel, ExpectResult = true},
                new { Type = ImageTypes.UInt8,         ExpectResult = true},
                new { Type = ImageTypes.UInt16,        ExpectResult = true},
                new { Type = ImageTypes.HsiPixel,      ExpectResult = true},
                new { Type = ImageTypes.Float,         ExpectResult = true},
                new { Type = ImageTypes.Double,        ExpectResult = true}
            };

            foreach (var test in tests)
            {
                var cols = this.NextRandom(1, 100);
                var rows = this.NextRandom(1, 100);
                var array = CreateArray2D(test.Type, rows, cols);
                Assert.AreEqual(array.Columns, cols);
                Assert.AreEqual(array.Rows, rows);
                Assert.AreEqual(array.Size, cols * rows);
                var rect = array.Rect;
                Assert.AreEqual(rect.Width, (uint)cols);
                Assert.AreEqual(rect.Height, (uint)rows);
                Assert.AreEqual(rect.Left, 0);
                Assert.AreEqual(rect.Top, 0);
                this.DisposeAndCheckDisposedState(array);
            }
        }

        [TestMethod]
        public void CreateArray2D2()
        {
            var tests = new[]
            {
                new { Type = ImageTypes.RgbPixel,      ExpectResult = true},
                new { Type = ImageTypes.RgbAlphaPixel, ExpectResult = true},
                new { Type = ImageTypes.UInt8,         ExpectResult = true},
                new { Type = ImageTypes.UInt16,        ExpectResult = true},
                new { Type = ImageTypes.HsiPixel,      ExpectResult = true},
                new { Type = ImageTypes.Float,         ExpectResult = true},
                new { Type = ImageTypes.Double,        ExpectResult = true}
            };

            foreach (var test in tests)
            {
                var array = CreateArray2D(test.Type);
                this.DisposeAndCheckDisposedState(array);
            }
        }

        [TestMethod]
        public void CreateArray2DMatrix()
        {<commit_msg>test: add test parameter<commit_after>﻿using System;
using DlibDotNet.Tests.Matrix;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DlibDotNet.Tests.Array2D
{

    [TestClass]
    public class Array2DTest : TestBase
    {

        [TestMethod]
        public void CreateArray2D()
        {
            var tests = new[]
            {
                new { Type = ImageTypes.RgbPixel,      ExpectResult = true},
                new { Type = ImageTypes.RgbAlphaPixel, ExpectResult = true},
                new { Type = ImageTypes.UInt8,         ExpectResult = true},
                new { Type = ImageTypes.UInt16,        ExpectResult = true},
                new { Type = ImageTypes.UInt32,        ExpectResult = true},
                new { Type = ImageTypes.Int8,          ExpectResult = true},
                new { Type = ImageTypes.Int16,         ExpectResult = true},
                new { Type = ImageTypes.Int32,         ExpectResult = true},
                new { Type = ImageTypes.HsiPixel,      ExpectResult = true},
                new { Type = ImageTypes.Float,         ExpectResult = true},
                new { Type = ImageTypes.Double,        ExpectResult = true}
            };

            foreach (var test in tests)
            {
                var cols = this.NextRandom(1, 100);
                var rows = this.NextRandom(1, 100);
                var array = CreateArray2D(test.Type, rows, cols);
                Assert.AreEqual(array.Columns, cols);
                Assert.AreEqual(array.Rows, rows);
                Assert.AreEqual(array.Size, cols * rows);
                var rect = array.Rect;
                Assert.AreEqual(rect.Width, (uint)cols);
                Assert.AreEqual(rect.Height, (uint)rows);
                Assert.AreEqual(rect.Left, 0);
                Assert.AreEqual(rect.Top, 0);
                this.DisposeAndCheckDisposedState(array);
            }
        }

        [TestMethod]
        public void CreateArray2D2()
        {
            var tests = new[]
            {
                new { Type = ImageTypes.RgbPixel,      ExpectResult = true},
                new { Type = ImageTypes.RgbAlphaPixel, ExpectResult = true},
                new { Type = ImageTypes.UInt8,         ExpectResult = true},
                new { Type = ImageTypes.UInt16,        ExpectResult = true},
                new { Type = ImageTypes.UInt32,        ExpectResult = true},
                new { Type = ImageTypes.Int8,          ExpectResult = true},
                new { Type = ImageTypes.Int16,         ExpectResult = true},
                new { Type = ImageTypes.Int32,         ExpectResult = true},
                new { Type = ImageTypes.HsiPixel,      ExpectResult = true},
                new { Type = ImageTypes.Float,         ExpectResult = true},
                new { Type = ImageTypes.Double,        ExpectResult = true}
            };

            foreach (var test in tests)
            {
                var array = CreateArray2D(test.Type);
                this.DisposeAndCheckDisposedState(array);
            }
        }

        [TestMethod]
        public void CreateArray2DMatrix()
        {
{'fraction_non_alphanumeric': 0.0920568122041031, 'fraction_numerical': 0.010871471155532176, 'mean_word_length': 1.443873179091688, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6072227', 'n_tokens_mistral': 1539, 'n_tokens_neox': 1434, 'n_words': 337}