Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (40 sloc) 1.11 KB
/*********************************************************
* Created by manparvesh on 7/6/18.
*********************************************************/
#include <assert.h>
#include "regx.h"
int main(){
char *pattern = ".*";
char *text = "abcdfseirjhewo34434jj";
assert(search(pattern, text));
pattern = "1.";
text = "as34434jj";
assert(!search(pattern, text));
pattern = "^3.";
text = "34434jj";
assert(search(pattern, text));
pattern = "^a3.";
text = "as34434jj";
assert(!search(pattern, text));
pattern = "jj$";
text = "as34434jj";
assert(search(pattern, text));
pattern = ".*j$";
text = "as34434jj";
assert(search(pattern, text));
pattern = ".*j";
text = "as34434jj";
assert(search(pattern, text));
pattern = "^a.*j$";
text = "as34434jj";
assert(search(pattern, text));
pattern = ".*j$";
text = "as34434jj";
assert(search(pattern, text));
pattern = "3.*j$";
text = "as34434jj";
assert(search(pattern, text));
pattern = ".*4";
text = "as34434jj";
assert(search(pattern, text));
}