Ad
  • Default User Avatar

    Managed to do it thanks for your help!

  • Default User Avatar

    Ok thank you :)

  • Default User Avatar

    I have now used a try catch to find the input string and I have my solution working in VS.
    Would it help if I messgae you my code?
    Thanks for your help.

  • Default User Avatar

    I am pretty sure the test inputs a zero length string, i tested it like this.

    if (strng == "")
    return "5";

    Test1
    Expected string length 0 but was 1. Strings differ at index 0.
    Expected:
    But was: "5"
    -----------^

    But when i return what i expect it is expecting, this happens.

    if (strng == "")
    return "";

    Test1
    System.OverflowException : Value was either too large or too small for an Int32.
    at System.Number.ParseInt32 (System.String s, NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00000] in :0
    at System.Int32.Parse (System.String s, IFormatProvider provider) [0x00000] in :0
    at System.Convert.ToInt32 (System.String value) [0x00000] in :0
    at WeightSort.orderWeight (System.String strng) [0x00000] in :0
    at WeightSortTests.Test1 () [0x00000] in :0

    The 50 random tests all pass fine.

  • Default User Avatar

    Please can you give what the test returns?

  • Default User Avatar

    C#

    I get an error if i:

    return "";

    the test say the expected result is

    expected:

    so I am a bit confussed as to what it wants...