Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Some languages do not have random tests, e.g Haskell.
passed the test, but also got an error132, so cannot submit. Could you help me what this code means?
WHY IS *** Error in `/home/codewarrior/solution': free(): invalid pointer: 0x0000000000608280 *** ?????
I have done nothing wrong, and all tests are passed!
How to solve the problem in the test() function!
I see now, the problem was with the empty string.
Thanks for your help!
@Sasquatch, read the error
String has no member 'enumerated'
and it hasn't in Swift 3.1.1, in 4.0 it has.That happens with this test
XCTAssertEqual(accum(""), "")
, try to catch that case and return accordingly.This comment is hidden because it contains spoiler information about the solution
Tried there as well, in 3.1, 4.0, doesnt work, but looks perfect in xcode.
On this site runs the sample tests without problems, but when I click on 'Attempt', it returns this error message:
fatal error: Can't form Range with upperBound < lowerBound
Current stack trace:
0 libswiftCore.so 0x00007ff031f57ae0 swift_reportError + 117
1 libswiftCore.so 0x00007ff031f72860 _swift_stdlib_reportFatalError + 62
2 libswiftCore.so 0x00007ff031d6dc46 + 1186886
3 libswiftCore.so 0x00007ff031eccf0d + 2625293
4 libswiftCore.so 0x00007ff031d6dc46 + 1186886
5 libswiftCore.so 0x00007ff031e880c0 specialized _fatalErrorMessage(StaticString, StaticString, file : StaticString, line : UInt, flags : UInt32) -> Never + 96
6 a.out 0x0000000000407996 + 31126
7 a.out 0x000000000040988b + 39051
8 a.out 0x0000000000408ec7 + 36551
9 a.out 0x000000000040a6f1 + 42737
10 libXCTest.so 0x00007ff032193b95 + 125845
11 libXCTest.so 0x00007ff03219408b + 127115
12 libXCTest.so 0x00007ff032193a80 XCTAssertEqual<A where ...> (@autoclosure () throws -> A, @autoclosure () throws -> A, @autoclosure () -> String, file : StaticString, line : UInt) -> () + 89
13 a.out 0x000000000040983d + 38973
14 a.out 0x000000000040c77a + 51066
15 a.out 0x0000000000408931 + 35121
16 a.out 0x000000000040c9e1 + 51681
17 libXCTest.so 0x00007ff0321bb33b + 287547
18 libXCTest.so 0x00007ff032192d52 + 122194
19 libXCTest.so 0x00007ff0321bb2c0 + 287424
20 a.out 0x0000000000404ffb + 20475
21 libXCTest.so 0x00007ff032192370 XCTestCase.invokeTest() -> () + 112
22 libXCTest.so 0x00007ff0321b1480 specialized XCTestCase.perform(XCTestRun) -> () + 313
23 libXCTest.so 0x00007ff0321922a0 XCTestCase.perform(XCTestRun) -> () + 14
24 libXCTest.so 0x00007ff03218bba0 XCTest.run() -> () + 516
25 libXCTest.so 0x00007ff0321b1a00 specialized XCTestSuite.perform(XCTestRun) -> () + 892
26 libXCTest.so 0x00007ff03218c1c0 XCTestSuite.perform(XCTestRun) -> () + 14
27 libXCTest.so 0x00007ff03218bba0 XCTest.run() -> () + 516
28 libXCTest.so 0x00007ff0321b1a00 specialized XCTestSuite.perform(XCTestRun) -> () + 892
29 libXCTest.so 0x00007ff0321b1a00 specialized XCTestSuite.perform(XCTestRun) -> () + 2007
30 libXCTest.so 0x00007ff03218bba0 XCTest.run() -> () + 557
31 a.out 0x00000000004044d3 + 17619
32 a.out 0x0000000000408033 + 32819
33 libc.so.6 0x00007ff02ff4ce50 __libc_start_main + 245
34 a.out 0x00000000004040b9 + 16569
Signal:
Process exited prematurely with a SIGILL signal.
CW's Swift version is 3.1.1. You can use a Playground in 3.1.1 here.
My code passed all the tests, works in playground, but returns error message in this system.