add basic unittesting; under Thompson's algo only 1 state for each label; implemented better recursive addstate function