Ad
  • Custom User Avatar

    Love the great usage of OOP. It's what Java was built for.

  • Custom User Avatar

    Haskell random test not working on random step
    Maybe this is problem with Eq and Ord

  • Custom User Avatar

    Not.

    There is one way to do nothing.

  • Custom User Avatar
  • Custom User Avatar

    The author is not responding. Closing.

  • Custom User Avatar

    Except that's not at all what I asked to you... (well, I wasn't clear enough)

    you should print the output on CW, not on your ide. Ofc you get false when doing it on your idea, we already knew that. The interesitng part is that, when I tweak just a bit your code so that it prints the output on CW, here is what I get:

     1 3 2 5 7 9 4 6 8
    Log
    4 9 8 2 6 1 3 7 5
    7 5 6 3 8 4 2 1 9
    6 4 3 1 5 8 7 9 2
    5 2 1 7 9 3 8 4 6
    9 8 7 4 2 6 5 3 1
    2 1 4 9 3 5 6 8 7
    3 6 5 8 1 7 9 2 4
    8 7 9 6 4 2 1 3 5 should be invalid
    
    true      <<< This is printed from the guts of your code, just before the very last line of the function
    
    Test Failed
    true was not false
    

    So there is definitely a problem, but seems to me it's definitely not in the kata itself.

  • Custom User Avatar

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

  • Custom User Avatar

    errrr...

    Test Failed
    true was not false
    
    like: "actual was not expected"?
    

    seems to me that your code is telling true, here, and that it's not was is expected.
    Print your output to the console to be sure, but imo, the problem is in your code.

  • Custom User Avatar

    yep, my code for this case return false

     Log
    4 9 8 2 6 1 3 7 5
    7 5 6 3 8 4 2 1 9
    6 4 3 1 5 8 7 9 2
    5 2 1 7 9 3 8 4 6
    9 8 7 4 2 6 5 3 1
    2 1 4 9 3 5 6 8 7
    3 6 5 8 1 7 9 2 4
    8 7 9 6 4 2 1 3 5 should be invalid
    Test Failed
    true was not false
    
    org.scalatest.exceptions.TestFailedException: true was not false
    	at org.scalatest.MatchersHelper$.indicateFailure(MatchersHelper.scala:340)
    	at org.scalatest.Matchers$ShouldMethodHelper$.shouldMatcher(Matchers.scala:6668)
    	at org.scalatest.Matchers$AnyShouldWrapper.should(Matchers.scala:6704)
    	at SudokuTest.$anonfun$tests$3(fixture.scala:88)
    	at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
    	at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
    	at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
    	at org.scalatest.Transformer.apply(Transformer.scala:22)
    	at org.scalatest.Transformer.apply(Transformer.scala:20)
    	at org.scalatest.FlatSpecLike$$anon$1.apply(FlatSpecLike.scala:1682)
    	at org.scalatest.TestSuite.withFixture(TestSuite.scala:196)
    	at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195)
    	at org.scalatest.FlatSpec.withFixture(FlatSpec.scala:1685)
    	at org.scalatest.FlatSpecLike.invokeWithFixture$1(FlatSpecLike.scala:1680)
    	at org.scalatest.FlatSpecLike.$anonfun$runTest$1(FlatSpecLike.scala:1692)
    	at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
    	at org.scalatest.FlatSpecLike.runTest(FlatSpecLike.scala:1692)
    	at org.scalatest.FlatSpecLike.runTest$(FlatSpecLike.scala:1674)
    	at org.scalatest.FlatSpec.runTest(FlatSpec.scala:1685)
    	at org.scalatest.FlatSpecLike.$anonfun$runTests$1(FlatSpecLike.scala:1750)
    	at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:396)
    	at scala.collection.immutable.List.foreach(List.scala:389)
    	at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
    	at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:373)
    	at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:410)
    	at scala.collection.immutable.List.foreach(List.scala:389)
    	at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
    	at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:379)
    	at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461)
    	at org.scalatest.FlatSpecLike.runTests(FlatSpecLike.scala:1750)
    	at org.scalatest.FlatSpecLike.runTests$(FlatSpecLike.scala:1749)
    	at org.scalatest.FlatSpec.runTests(FlatSpec.scala:1685)
    	at org.scalatest.Suite.run(Suite.scala:1147)
    	at org.scalatest.Suite.run$(Suite.scala:1129)
    	at org.scalatest.FlatSpec.org$scalatest$FlatSpecLike$$super$run(FlatSpec.scala:1685)
    	at org.scalatest.FlatSpecLike.$anonfun$run$1(FlatSpecLike.scala:1795)
    	at org.scalatest.SuperEngine.runImpl(Engine.scala:521)
    	at org.scalatest.FlatSpecLike.run(FlatSpecLike.scala:1795)
    	at org.scalatest.FlatSpecLike.run$(FlatSpecLike.scala:1793)
    	at org.scalatest.FlatSpec.run(FlatSpec.scala:1685)
    	at org.scalatest.Suite.callExecuteOnSuite$1(Suite.scala:1210)
    	at org.scalatest.Suite.$anonfun$runNestedSuites$1(Suite.scala:1257)
    	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
    	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
    	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:191)
    	at org.scalatest.Suite.runNestedSuites(Suite.scala:1255)
    	at org.scalatest.Suite.runNestedSuites$(Suite.scala:1189)
    	at org.scalatest.tools.DiscoverySuite.runNestedSuites(DiscoverySuite.scala:30)
    	at org.scalatest.Suite.run(Suite.scala:1144)
    	at org.scalatest.Suite.run$(Suite.scala:1129)
    	at org.scalatest.tools.DiscoverySuite.run(DiscoverySuite.scala:30)
    	at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
    	at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13(Runner.scala:1340)
    	at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13$adapted(Runner.scala:1334)
    	at scala.collection.immutable.List.foreach(List.scala:389)
    	at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1334)
    	at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1031)
    	at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1010)
    	at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1500)
    	at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
    	at org.scalatest.tools.Runner$.main(Runner.scala:827)
    	at org.scalatest.tools.Runner.main(Runner.scala)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at scala.reflect.internal.util.ScalaClassLoader.$anonfun$run$2(ScalaClassLoader.scala:98)
    	at scala.reflect.internal.util.ScalaClassLoader.asContext(ScalaClassLoader.scala:32)
    	at scala.reflect.internal.util.ScalaClassLoader.asContext$(ScalaClassLoader.scala:30)
    	at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:129)
    	at scala.reflect.internal.util.ScalaClassLoader.run(ScalaClassLoader.scala:98)
    	at scala.reflect.internal.util.ScalaClassLoader.run$(ScalaClassLoader.scala:90)
    	at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:129)
    	at scala.tools.nsc.CommonRunner.run(ObjectRunner.scala:22)
    	at scala.tools.nsc.CommonRunner.run$(ObjectRunner.scala:21)
    	at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:39)
    	at scala.tools.nsc.CommonRunner.runAndCatch(ObjectRunner.scala:29)
    	at scala.tools.nsc.CommonRunner.runAndCatch$(ObjectRunner.scala:28)
    	at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:39)
    	at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:66)
    	at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:85)
    	at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
    	at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101)
    	at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
    
  • Custom User Avatar

    the real question is: is your code still returning false on that specific test on cw? If not, are you sure you're not reading the input of one test with the output of another or vice versa, or are you mutating something (I don't do scala)?

    "put in an easier way": paste here the complete message you get on cw.

  • Custom User Avatar

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

  • Custom User Avatar

    val invalidBoard=...

    See the "invalid", in there? Meaning the expected answer is false. So if the assertion fails, that means that your code isn't returning false.

    corolary:

    • either you read the logs the wrong way
    • or expected and actual are swapped. => need to know about the language your're using.
  • Custom User Avatar

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

  • Custom User Avatar

    Hi, i have some problem with this signature of option

      trait SOption[+A] {
        def apply[B]: (=> B, A => B) => B
      }
    

    when i try implement
    fromOption
    they always say that i have problem with this part

    => B,
    

    maybe it must be simple B

  • Custom User Avatar

    Do you can apply translation for scala language?

  • Loading more items...