Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factorial function failure #22

Open
zhelenskiy opened this issue Jun 1, 2022 · 0 comments
Open

Factorial function failure #22

zhelenskiy opened this issue Jun 1, 2022 · 0 comments

Comments

@zhelenskiy
Copy link

import java.util.*;
import java.math.*;

public class Solution {
  BigInteger f(long x) {
    if (x == 0) {
      return BigInteger.ONE;
    } else {
      return BigInteger.valueOf(x).multiply(f(x - 1));
    }
  } 
}

The result is

TEST GENERATION: SUCCEEDED
20:14:32.181 | INFO  | CacheClassProvider | Loaded: 3 path entries, 19922 classes, 62290443 bytes
20:14:33.166 | INFO  | UtBotTestCaseGenerator | |> Resuming method Solution.f(long)
20:14:45.982 | INFO  | Summarization | Diversity execution path percentage: 100
20:14:45.982 | ERROR | ConcreteExecutor | Unexpected error while sending to channel in 18: ConcreteExecutor-53-receiver, cmd=(0, ExceptionInKryoCommand(exception=java.lang.ThreadDeath))
kotlinx.coroutines.channels.ClosedSendChannelException: Channel was closed
	at kotlinx.coroutines.channels.Closed.getSendException(AbstractChannel.kt:1105) ~[utbot-cli.jar:?]
	at kotlinx.coroutines.channels.AbstractSendChannel.helpCloseAndResumeWithSendException(AbstractChannel.kt:210) ~[utbot-cli.jar:?]
	at kotlinx.coroutines.channels.AbstractSendChannel.access$helpCloseAndResumeWithSendException(AbstractChannel.kt:19) ~[utbot-cli.jar:?]
	at kotlinx.coroutines.channels.AbstractSendChannel.sendSuspend(AbstractChannel.kt:200) ~[utbot-cli.jar:?]
	at kotlinx.coroutines.channels.AbstractSendChannel.send(AbstractChannel.kt:137) ~[utbot-cli.jar:?]
	at com.huawei.utbot.instrumentation.ConcreteExecutor$restartIfNeeded$$inlined$bracket$lambda$1$1$1.invokeSuspend(ConcreteExecutor.kt:263) [utbot-cli.jar:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [utbot-cli.jar:?]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [utbot-cli.jar:?]
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274) [utbot-cli.jar:?]
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84) [utbot-cli.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) [utbot-cli.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) [utbot-cli.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) [utbot-cli.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) [utbot-cli.jar:?]
	at com.huawei.utbot.instrumentation.ConcreteExecutor$restartIfNeeded$$inlined$bracket$lambda$1$1.invoke(ConcreteExecutor.kt:249) [utbot-cli.jar:?]
	at com.huawei.utbot.instrumentation.ConcreteExecutor$restartIfNeeded$$inlined$bracket$lambda$1$1.invoke(ConcreteExecutor.kt:101) [utbot-cli.jar:?]
	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30) [utbot-cli.jar:?]
20:14:45.990 | INFO  | Summarization | No execution traces found in test case for method Solution,     java.math.BigInteger f(long)
    {
        long l0, $l2;
        byte $b1;
        java.math.BigInteger $r0, $r2, $r3, $r4;
        Solution r1;

        r1 := @this: Solution;

        l0 := @parameter0: long;

        $b1 = l0 cmp 0L;

        if $b1 != 0 goto label1;

        $r4 = <java.math.BigInteger: java.math.BigInteger ONE>;

        return $r4;

     label1:
        $r0 = staticinvoke <java.math.BigInteger: java.math.BigInteger valueOf(long)>(l0);

        $l2 = l0 - 1L;

        $r2 = virtualinvoke r1.<Solution: java.math.BigInteger f(long)>($l2);

        $r3 = virtualinvoke $r0.<java.math.BigInteger: java.math.BigInteger multiply(java.math.BigInteger)>($r2);

        return $r3;
    }


TEST RUN: SUCCEEDED
Tests run: 1
Succeeded tests: 0
Failed tests: 1

***FAILED TESTS INFO***
Test header: initializationError(SolutionTest)
Exception: org.junit.runners.model.InvalidTestClassError: Invalid test class 'SolutionTest':
  1. No runnable methods
Message: Invalid test class 'SolutionTest':
  1. No runnable methods
Description: initializationError(SolutionTest)

Ignored tests: 0
Run tests: FAILED
Running the entire test suite - completed in 3 (ms)

Btw, ❤️ for using Kotlin and coroutines from me as the Kotlin team member.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant