input: Write a function to generate a Markov chain given a text input. The function should split the text into words, create a dictionary where keys are words and values are dictionaries of subsequent words with their frequencies, and then generate a new text of a specified length (e.g., 100 words) based on these frequencies. If the required number of words cannot be generated due to lack of subsequent words, the function should end the generation process gracefully. The function should return the generated text as a string.
  
  assert generateMarkov('Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice `without pictures or conversation?')==some_output
  assert generateMarkov('The quick brown fox jumps over the lazy dog.')==some_output
  assert generateMarkov('')==some_output
  assert generateMarkov('Python is a powerful programming language.')==some_output
  assert generateMarkov('Hello world')==some_output
  
  In the example above, `some_output` should be replaced with actual generated text based on the Markov chain model for each test case.
output: 
  def generateMarkov(text):
      import random
      words = text.split()
      if not words:
          return ""
      chain = {}
      for i in range(len(words) - 1):
          word = words[i]
          next_word = words[i + 1]
          if word not in chain:
              chain[word] = {}
          if next_word not in chain[word]:
              chain[word][next_word] = 0
          chain[word][next_word] += 1
  
      current_word = random.choice(words)
      generated_text = [current_word]
      for _ in range(100):
          if current_word not in chain:
              break
          next_words = list(chain[current_word].keys())
          weights = list(chain[current_word].values())
          current_word = random.choices(next_words, weights=weights)[0]
          generated_text.append(current_word)
  
      return ' '.join(generated_text)
  