Cosmological evolution of viable models in the generalized scalar-tensor theory