Ad
  • Custom User Avatar

    The biggest number given in the swift test is Int.max, so if your solution happens to attempt to make a number higher than the input using normal Swift math operations, it will crash with an integer overflow error. It would be nice if the Swift test system printed the error that caused the crash, like it does in Xcode, but it doesn't.

  • Default User Avatar

    Getting the following error when attempting this in Swift. Says all tests have passed but doesn't accept it as a solution

    STDERR:
    0 swift 0x00000000034bf568 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
    1 swift 0x00000000034c0146
    2 libpthread.so.0 0x00007f6e2d68c330
    3 libpthread.so.0 0x00007f6e2d9ff707
    4 libpthread.so.0 0x00007f6e2da01031
    5 libpthread.so.0 0x00007f6e2da021fa
    6 libpthread.so.0 0x00007f6e2da0091b
    7 libpthread.so.0 0x00007f6e2da022a5
    8 libXCTest.so 0x00007f6e28a21641
    9 libXCTest.so 0x00007f6e28a40460
    10 libXCTest.so 0x00007f6e28a3d5c5
    11 libXCTest.so 0x00007f6e28a3f806
    12 libXCTest.so 0x00007f6e28a279e0
    13 libXCTest.so 0x00007f6e28a215c5 TF6XCTest14XCTAssertEqualuRxs9EquatablerFTKzT_xKzT_xKT_SS4fileVs12StaticString4lineSu_T + 101
    14 libXCTest.so 0x00007f6e2da00f79 TF6XCTest14XCTAssertEqualuRxs9EquatablerFTKzT_xKzT_xKT_SS4fileVs12StaticString4lineSu_T + 83753497
    15 libXCTest.so 0x00007f6e2da02e90 TF6XCTest14XCTAssertEqualuRxs9EquatablerFTKzT_xKzT_xKT_SS4fileVs12StaticString4lineSu_T + 83761456
    16 libXCTest.so 0x00007f6e2da0043e TF6XCTest14XCTAssertEqualuRxs9EquatablerFTKzT_xKzT_xKT_SS4fileVs12StaticString4lineSu_T + 83750622
    17 libXCTest.so 0x00007f6e2da02fb5 TF6XCTest14XCTAssertEqualuRxs9EquatablerFTKzT_xKzT_xKT_SS4fileVs12StaticString4lineSu_T + 83761749
    18 libXCTest.so 0x00007f6e28a546ab
    19 libXCTest.so 0x00007f6e28a2b1a2
    20 libXCTest.so 0x00007f6e28a54660
    21 libXCTest.so 0x00007f6e28a543e0
    22 libXCTest.so 0x00007f6e28a2a280 TFC6XCTest10XCTestCase10invokeTestfT_T + 112
    23 libXCTest.so 0x00007f6e28a42219 TTSf4g_n___TFC6XCTest10XCTestCase7performfCS_9XCTestRunT + 313
    24 libXCTest.so 0x00007f6e28a2a14e TFC6XCTest10XCTestCase7performfCS_9XCTestRunT + 14
    25 libXCTest.so 0x00007f6e28a29f45 TFC6XCTest6XCTest3runfT_T + 629
    26 libXCTest.so 0x00007f6e28a42ee5 TTSf4g_n___TFC6XCTest11XCTestSuite7performfCS_9XCTestRunT + 789
    27 libXCTest.so 0x00007f6e28a433b3 TTSf4g_n___TFC6XCTest11XCTestSuite7performfCS_9XCTestRunT + 2019
    28 libXCTest.so 0x00007f6e28a433b3 TTSf4g_n___TFC6XCTest11XCTestSuite7performfCS_9XCTestRunT + 2019
    29 libXCTest.so 0x00007f6e28a2f6db _TF6XCTest7XCTMainFGSaT13testCaseClassMCS_10XCTestCase8allTestsGSaTSSFzS0_T_____Os5Never + 4283
    30 libXCTest.so 0x00007f6e2d9ff0e9 _TF6XCTest7XCTMainFGSaT13testCaseClassMCS_10XCTestCase8allTestsGSaTSSFzS0_T_____Os5Never + 83692233
    31 swift 0x0000000000c795f2 llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef) + 1042
    32 swift 0x0000000000c7d0ff llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::vector > const&, char const* const*) + 1215
    33 swift 0x000000000083ca6f swift::RunImmediately(swift::CompilerInstance&, std::vector > const&, swift::IRGenOptions&, swift::SILOptions const&) + 2303
    34 swift 0x00000000008364f8
    35 swift 0x0000000000831377 swift::performFrontend(llvm::ArrayRef, char const*, void*, swift::FrontendObserver*) + 2551
    36 swift 0x00000000007f8788 main + 3016
    37 libc.so.6 0x00007f6e2be35f45 __libc_start_main + 245
    38 swift 0x00000000007f5e56
    Stack dump:
    0. Program arguments: /swift-vol/swift-gen/usr/bin/swift -frontend -interpret /tmp/swift117011-18-1bsoqew.jysvhrggb9/solution.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name solution