calculation tree and tests