Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Tests should use python test framework: https://docs.codewars.com/languages/python/codewars-test

    • missing import
    • missing test.it blocks
    • missing test.describe
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    In c++ it keeps failing with exit code 132, eventhough the tests seem to pass and the log is empty.
    I tried to google exit code 132, but found nothing that seemed applicable to this situation.
    Does anybody know what might be going on here?

  • Custom User Avatar
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Expected: equal to [ ]

    Actual: [

    how can it be... other tests are ok

    please, anyone, give me a hint

    c++

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    A best practice when templating this kind of algorithm is to
    make it generic, i.e. pass a range or [begin,end) as template parameters...
    Indeed, the initial parameter says 'iterable' :-)
    May also test with any kind of ordered iterable, so that one may use concepts one day and return {} if the values cannot be ordered ?

  • Custom User Avatar

    There's a few missing C# test cases

    [Test]
    public void NullSequence()
    {
      Assert.That(Kata.UniqueInOrder(null), Throws.InstanceOf<ArgumentNullException>());
      // OR (undefined requirement)
      Assert.That(Kata.UniqueInOrder(null), Is.Empty)
    }
    
    [Test]
    public void NullValue()
    {
      // Breaks solutions that use default as a placeholder value
      Assert.That(Kata.UniqueInOrder(new string[]{"Hello", null, null, "world"}), Is.EqualTo(new string[]{"Hello", null, "world"}));
    }
    
    [Test]
    public void LeadingZero()
    {
      // Breaks solutions that use default as a placeholder value
      Assert.That(Kata.UniqueInOrder(new int[]{0, 1, 2, 3}), Is.EqualTo(new int[]{0, 1, 2, 3}));
    }
    
    [Test]
    public void EmptyIntegerArray()
    {
      // Breaks solutions that use default as a placeholder value
      Assert.That(Kata.UniqueInOrder(Array.Empty<int>()), Is.EqualTo(Array.Empty<int>()));
    }
    
    [Test]
    public void MixedTypes()
    {
      // Make sure solutions don't use assumptions between types
      Assert.That(Kata.UniqueInOrder(new object[]{1, "2", 2, 2, "5", "5"}), Is.EqualTo(new object[]{1, "2", 2, "5"}));
    }
    
    private class Foo
    {
      public override bool Equals(object other) => other is Foo || other is Bar;
    }
    
    private class Bar
    {
      public override bool Equals(object other) => other is Foo || other is Bar;
    }
    
    [Test]
    public void RemovesDuplicateCustomTypes()
    {
      // Make sure solutions don't use assumptions between types
      Assert.That(Kata.UniqueInOrder(new object[]{new Foo(), 1, new Bar(), new Foo(), string.Empty}).Select(res => res.GetType()), Is.EqualTo(new object[]{typeof(Foo), typeof(1), typeof(Bar), typeof(string)}));
    }
    
  • Custom User Avatar

    I got confused for data types .....

    like, example [1, 2, 3, 4, "4", 4, "4", "4"]

    should it be [1, 2, 3, 4, "4", 4, "4"]

    or

    [1, 2, 3, 4]

    ??

    I am using JavaScript.

  • Custom User Avatar

    The sample tests in crystal expect an array of strings whereas the random tests expect an array of characters

  • Custom User Avatar

    Ruby 3.0 should be enabled, see this to learn how to do it

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...