Ad
  • Custom User Avatar

    i cleaned up the Java tests suite and enabled JUnit 5. I kept the testing() function because it leads to much shorter lines than assertEquals(Accumul.accum(... and it allows presenting the input in an assertion message.

  • Custom User Avatar

    fixed + upgrade to JUnit 5 + the initial code now compiles + better assertion messages + the tests suite no longer logs to stdout

  • Custom User Avatar

    you under-allocate. your formula is wrong:

    char *s = malloc(n / 2 * (n - 3) * sizeof(char) + 1);
    

    for "abc", n = 3, the result string requires "A-Bb-Ccc" = 9 bytes, but your formula allocates 3 / 2 * (3 - 3) + 1 = 1 byte

  • Custom User Avatar
  • Custom User Avatar

    Oh dear, I remember those!

    Merged!

  • Custom User Avatar

    C:

    • the initial code does not compile
    • it is not explained what kind of pointer to return

    fork fixing it (author inactive)

    also massively simplifying the tests suite (removal of 200+ lines of preloaded code, among other things)

  • Custom User Avatar

    Fixed.

  • Custom User Avatar

    Im new to this but just noticed theres a tiny issue (not a critical problem at all) where in
    public class Accumul
    {
    public static string Accum(string s)
    {
    return ""; // your code
    }
    }
    The public static string is written as "String" causing an error.

  • Custom User Avatar