input: Write a function to implement a basic version control system in Python that keeps track of changes in the code. The function should define a class `VersionControl` with methods to initialize the system with code lines, commit changes, and restore to a previous state. Additionally, provide assertive test cases to ensure the correctness of the implementation.
  assert VersionControl(["print('Hello, world!')"]).commit()
  assert VersionControl(["print('Hello, world!')", "print('Goodbye, world!')"]).commit()
  assert VersionControl(["print('Hello, world!')", "print('Goodbye, world!')"]).restore()
  assert VersionControl(["print('Hello, world!')", "print('Goodbye, world!')"]).commit()
  assert VersionControl([]).commit()==0
output: class VersionControl:
      def __init__(self, code_lines):
          self.code_lines = code_lines
          self.history = []
  
      def commit(self):
          if self.code_lines:
              self.history.append(self.code_lines)
              return len(self.history)
          return 0
  
      def restore(self):
          if self.history:
              self.code_lines = self.history[-1]
              return self.code_lines
          return []