main: add basic functional test

wait on #1315 
sure. it is in the following PRs. i don't want to enroll too many stuffs.