Modularized tst_bic and add some helper functions for global test