<commit_before>module DequeTests

open NUnit.Framework
open Deque

type DequeTests() =

    [<Test>]
    member tests.push_and_pop_are_first_in_last_out_order() =
        let deque = new Deque<int>()
        deque.push(10)
        deque.push(20)
        Assert.That(deque.pop(), Is.EqualTo(20))
        Assert.That(deque.pop(), Is.EqualTo(10))

    [<Test>]
    [<Ignore("Remove to run test")>]
    member tests.push_and_shift_are_first_in_first_out_order() =
        let deque = new Deque<int>()
        deque.push(10)
        deque.push(20)
        Assert.That(deque.shift(), Is.EqualTo(10))
        Assert.That(deque.shift(), Is.EqualTo(20))

    [<Test>]
    [<Ignore("Remove to run test")>]
    member tests.unshift_and_shift_are_last_in_first_out_order() =
        let deque = new Deque<int>()
        deque.unshift(10)
        deque.unshift(20)
        Assert.That(deque.shift(), Is.EqualTo(20))
        Assert.That(deque.shift(), Is.EqualTo(10))

    [<Test>]
    [<Ignore("Remove to run test")>]
    member tests.unshift_and_pop_are_last_in_last_out_order() =
        let deque = new Deque<int>()
        deque.unshift(10)
        deque.unshift(20)
        Assert.That(deque.pop(), Is.EqualTo(10))
        Assert.That(deque.pop(), Is.EqualTo(20))

    [<Test>]
    [<Ignore("Remove to run test")>]
    member tests.push_and_pop_can_handle_multiple_values() =
        let deque = new Deque<int>()
        deque.push(10)
        deque.push(20)
        deque.push(30)
        Assert.That(deque.pop(), Is.EqualTo(30))
        Assert.That(deque.pop(), Is.EqualTo(20))
        Assert.That(deque.pop(), Is.EqualTo(10))

    [<Test>]
    [<Ignore("Remove to run test")>]
    member tests.unshift_and_shift_can_handle_multiple_values() =
        let deque = new Deque<int>()
        deque.unshift(10)
        deque.unshift(20)
        deque.unshift(30)
        Assert.That(deque.shift(), Is.EqualTo(30))
        Assert.That(deque.shift(), Is.EqualTo(20))
        Assert.That(deque.shift(), Is.EqualTo(10))

    [<Test>]
    [<Ignore("Remove to run test")>]
    member tests.All_methods_of_manipulating_the_deque_can_be_used_together() =
        let deque = new Deque<int>()
        deque.push(10)
        deque.push(20)
        Assert.That(deque.pop(), Is.EqualTo(20))

        deque.push(30)
        Assert.That(deque.shift(), Is.EqualTo(10))

        deque.unshift(40)
        deque.push(50)
        Assert.That(deque.shift(), Is.EqualTo(40))
        Assert.That(deque.pop(), Is.EqualTo(50))
        Assert.That(deque.shift(), Is.EqualTo(30))<commit_msg>Convert linked-list exercise to idiomatic F#<commit_after>module DequeTests

open NUnit.Framework
open Deque

[<Test>]
let ``Push and pop are first in last out order`` () =
    let deque = new Deque<int>()
    deque.push(10)
    deque.push(20)
    Assert.That(deque.pop(), Is.EqualTo(20))
    Assert.That(deque.pop(), Is.EqualTo(10))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Push and shift are first in first out order`` () =
    let deque = new Deque<int>()
    deque.push(10)
    deque.push(20)
    Assert.That(deque.shift(), Is.EqualTo(10))
    Assert.That(deque.shift(), Is.EqualTo(20))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Unshift and shift are last in first out order`` () =
    let deque = new Deque<int>()
    deque.unshift(10)
    deque.unshift(20)
    Assert.That(deque.shift(), Is.EqualTo(20))
    Assert.That(deque.shift(), Is.EqualTo(10))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Unshift and pop are last in last out order`` () =
    let deque = new Deque<int>()
    deque.unshift(10)
    deque.unshift(20)
    Assert.That(deque.pop(), Is.EqualTo(10))
    Assert.That(deque.pop(), Is.EqualTo(20))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Push and pop can handle multiple values`` () =
    let deque = new Deque<int>()
    deque.push(10)
    deque.push(20)
    deque.push(30)
    Assert.That(deque.pop(), Is.EqualTo(30))
    Assert.That(deque.pop(), Is.EqualTo(20))
    Assert.That(deque.pop(), Is.EqualTo(10))

[<Test>]
[<Ignore("Remove to run test")>]    
let ``Unshift and shift can handle multiple values`` () =
    let deque = new Deque<int>()
    deque.unshift(10)
    deque.unshift(20)
    deque.unshift(30)
    Assert.That(deque.shift(), Is.EqualTo(30))
    Assert.That(deque.shift(), Is.EqualTo(20))
    Assert.That(deque.shift(), Is.EqualTo(10))

[<Test>]
[<Ignore("Remove to run test")>]
let ``All methods of manipulating the deque can be used together`` () =
    let deque = new Deque<int>()
    deque.push(10)
    deque.push(20)
    Assert.That(deque.pop(), Is.EqualTo(20))

    deque.push(30)
    Assert.That(deque.shift(), Is.EqualTo(10))

    deque.unshift(40)
    deque.push(50)
    Assert.That(deque.shift(), Is.EqualTo(40))
    Assert.That(deque.pop(), Is.EqualTo(50))
    Assert.That(deque.shift(), Is.EqualTo(30))
{'fraction_non_alphanumeric': 0.166597767672592, 'fraction_numerical': 0.03141794129805705, 'mean_word_length': 3.1218057921635434, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '4541434', 'n_tokens_mistral': 1855, 'n_tokens_neox': 1770, 'n_words': 331}