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

Strange Scala Unit test Translation for output Tuple Type w/ extra parenthesis #65

Open
PootieT opened this issue May 8, 2023 · 4 comments

Comments

@PootieT
Copy link

PootieT commented May 8, 2023

Example: HumanEval_155_even_odd_count

import scala.math._
import scala.collection.mutable._
object Problem {
    def evenOddCount(num : Long) : Tuple2[Long, Long] = {
        // Some program here
    } 
    def main(args: Array[String]) = {
    assert(evenOddCount((7l)).equals(((0l, 1l))));
    assert(evenOddCount((-78l)).equals(((1l, 1l))));
    assert(evenOddCount((3452l)).equals(((2l, 2l))));
    assert(evenOddCount((346211l)).equals(((3l, 3l))));
    assert(evenOddCount((-345821l)).equals(((3l, 3l))));
    assert(evenOddCount((-2l)).equals(((1l, 0l))));
    assert(evenOddCount((-45347l)).equals(((2l, 3l))));
    assert(evenOddCount((0l)).equals(((1l, 0l))));
    }

}

There is an extra level of parenthesis around theses expected tuple values that doesn't match up with what the programs output. At first I thought this is mistranslated for all programs with output type of Tuple2, but seems like it only applies to this one program..

@arjunguha
Copy link
Member

Does this cause errors?

@PootieT
Copy link
Author

PootieT commented May 8, 2023

Yeah, I tried removing the extra parenthesis and the same program starts passing tests.

@abhijangda
Copy link
Collaborator

abhijangda commented Jun 10, 2023

Which scala version are you using? I compiled it with scala 2.13.11 and it passed tests. Here is the code I used:

import scala.math._
import scala.collection.mutable._
object Problem {
    def evenOddCount(num : Long) : Tuple2[Long, Long] = {
        return (0l, 1l); // Some program here
    } 
    def main(args: Array[String]) = {
    assert(evenOddCount((7l)).equals(((0l, 1l))));
    }
}

@arjunguha
Copy link
Member

@PootieT :)

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

3 participants