testing a complex functinoaloity