Unknown test error in "All Your Base"

I got such error running tests:

An error occurred
An error occurred while running your tests. This might mean that there was an issue in our infrastructure, or it might mean that you have something in your code that's causing our systems to break.

Please check your code, and if nothing seems to be wrong, try running the tests again.

I feel confused because the behavior of these functions is as I expected. Here is my code:

(defpackage :all-your-base
  (:use :cl)
  (:export :rebase))

(in-package :all-your-base)

(defun rebase (list-digits in-base out-base)
  (let ((decimal (to-decimal list-digits in-base)))
       (decimal-to-base decimal out-base nil)))

;; convert a list from in-base to decimal base 
(defun to-decimal (list-digits in-base)
  (reduce 
    (lambda (acc x) (+ (* acc in-base) x))
    list-digits
    :initial-value 0))

;; convert a decimal number to an out-base list
(defun decimal-to-base (decimal out-base acc)
  (if (<= decimal (1- out-base))
    (cons decimal acc)
    (let* ((quotient (floor decimal out-base))
           (remainder (mod decimal out-base)))
         (decimal-to-base quotient out-base (cons remainder acc)))))

Have you tested your code against the test suite locally? See the documentation at Testing on the Common Lisp track | Exercism's Docs. Do you get any error messages running the tests locally? If so, what do they say?

Hi, I test locally according to the guide. It says my code exhaust heap memory :frowning:

* (all-your-base-test:run-tests)

Running test suite ALL-YOUR-BASE-SUITE
 Running test SINGLE-BIT-ONE-TO-DECIMAL .
 Running test BINARY-TO-SINGLE-DECIMAL .
 Running test SINGLE-DECIMAL-TO-BINARY .
 Running test BINARY-TO-MULTIPLE-DECIMAL .
 Running test DECIMAL-TO-BINARY .
 Running test TRINARY-TO-HEXADECIMAL .
 Running test HEXADECIMAL-TO-TRINARY .
 Running test NUMBER-15-BIT-INTEGER .
 Running test EMPTY-LIST .
 Running test SINGLE-ZERO .
 Running test MULTIPLE-ZEROS .
 Running test LEADING-ZEROS .
 Running test INPUT-BASE-IS-ONE f
 Running test INPUT-BASE-IS-ZERO f
 Running test INPUT-BASE-IS-NEGATIVE f
 Running test NEGATIVE-DIGIT f
 Running test INVALID-POSITIVE-DIGIT f
Heap exhausted during garbage collection: 0 bytes available, 16 requested.
     | Immobile Objects |
 Gen layout symbol   code  Boxed   Cons    Raw   Code  SmMix  Mixed  LgRaw LgCode  LgMix Waste%       Alloc        Trig   Dirty GCs Mem-age
  1      0      0      0      0   9855      0      0      1      0      0      0      0    0.1   322575344    10737418    9856   0  1.0000
  2    283    850   2571     71  13760     43      3     15     15      0      0      0    0.1   455167744     2000000      44   0  0.0000
  3      0      0      0      0      0      0      0      0      0      0      0      0    0.0
  0     2000000       0   0  0.0000
  4      0      0      0      0      0      0      0      0      0      0      0      0    0.0
  0     2000000       0   0  0.0000
  5      0      0      0      0      0      0      0      0      0      0      0      0    0.0
  0     2000000       0   0  0.0000
  6    758  23062  19120    211    111      7      3     11     13      0      0      9    3.9    11495408     2000000      13   0  0.0000
  7      0      0      0      0   8639      0      0      1      0      0      0      0    0.1   282944528     2000000    8640   0  0.0000
Tot   1041  23912  21691    282  32365     50      6     28     28      0      0      9    0.1  1072182544 [99.9% of 1073741824 max]
GC control variables:
   *GC-INHIBIT* = true
   *GC-PENDING* = true
   *STOP-FOR-GC-PENDING* = false
Collection trigger variables:
   dynamic_space_size = 1073741824
   bytes_allocated = 1072182544
   auto_gc_trigger = 789179059
   bytes_consed_between_gcs = 53687091
fatal error encountered in SBCL pid 6678 tid 6678:
Heap exhausted, game over.

Is it possible you have an infinite loop (eg with edge case inputs)?

Thanks :smiling_face: ! it actually fall into a infinite loop while out-base smaller than 2.