Ad
  • Custom User Avatar

    I don't understand why you called the two batteries of random tests ascii and utf8. I'm not familiar with UTF8 and characters encoding in general, but as far as I understand it, the first series tests only alphanumeric values, and however all characters generated in any series are ascii characters (in the range 32-127, which is fine). It is not a bad idea to have two series of tests but if I'm not wrong it would be better to give them another name (for example simply "alphanumeric" and "random characters"). I apologize if I'm wrong, in this case could you give me a quick explanation or a link to a resource that would allow me to understand it more clearly?

  • Custom User Avatar

    I think so too, it is fixed

    Removed the comment too

  • Custom User Avatar

    For random tests, I think it's better to compute a random length for each new string (for example random number between 30 and 100). It doesn't make much sense to test increasing lengths like it is currently the case (I could not find a similar thing in other languages).

    Also, you should remove those two header comment lines at least from testcases (in sample tests it can be good so users can add their own tests, and have a link to the documentation of the framework):

    // Add your tests here.
    // See https://doc.rust-lang.org/stable/rust-by-example/testing/unit_testing.html
    
  • Custom User Avatar
  • Custom User Avatar

    Sample tests crash:

    error: expected `;`, found `assert_eq`
      --> src/lib.rs:14:47
       |
    14 |         assert_eq!(string_clean("@ @"), "@ @")
       |                                               ^ help: add `;` here
    15 |         assert_eq!(string_clean("123456789"), "")
       |         --------- unexpected token
    
    error: expected `;`, found `assert_eq`
      --> src/lib.rs:15:50
       |
    15 |         assert_eq!(string_clean("123456789"), "")
       |                                                  ^ help: add `;` here
    16 |         assert_eq!(string_clean("Cod3eWa4rs"), "Codewars")
       |         --------- unexpected token
    
    error: expected `;`, found `assert_eq`
      --> src/lib.rs:16:59
       |
    16 |         assert_eq!(string_clean("Cod3eWa4rs"), "Codewars")
       |                                                           ^ help: add `;` here
    17 |         assert_eq!(string_clean("H3ello0 W0or1ld !", "Hello World"))
       |         --------- unexpected token
    
    error: unexpected end of macro invocation
      --> src/lib.rs:17:68
       |
    17 |         assert_eq!(string_clean("H3ello0 W0or1ld !", "Hello World"))
       |                                                                    ^ missing tokens in macro arguments
    
    error: could not compile `challenge` due to 4 previous errors
    
    
    NOTE: Line numbers in error messages can be incorrect due to concatenation.
    
  • Custom User Avatar

    Rust Translation (author gone)