#!/bin/sh

# This test generates a passphrase using diceware and makes sure that
# the requested number of words are returned.

main() {
  output=$( diceware -d " " -n 8 )

  length=$( echo ${output} | wc -c )
  [ ${length} -ge 15 ]

  spacecount=$( echo ${output} | tr -C -d " " | wc -c )
  [ ${spacecount} -eq 7 ]

  doublespace=$( echo ${output} | grep "  " )
  [ -z "${doublespace}" ]
}

main
