Test matching function