input: Write a function to generate a list of Fibonacci numbers up to a given number.
  assert generate_fibonacci(5) == [0, 1, 1, 2, 3]
  assert generate_fibonacci(8) == [0, 1, 1, 2, 3, 5, 8, 13]
  assert generate_fibonacci(1) == [0]
output: def generate_fibonacci(n):
      if n < 1:
          return []
      fib_sequence = [0, 1]
      while True:
          next_fib = fib_sequence[-1] + fib_sequence[-2]
          if next_fib > n:
              break
          fib_sequence.append(next_fib)
      return fib_sequence if n > 0 else [0]