Skip to content

yuxiaolejs/cs138-hw2-q2-autograder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Testing util for HW2 Q2

Since the Gradescope autograder is not out yet, I made a testing utility for myself to test my regexes. Hopefully, this can also help other people in the class.

To instructor team

Please let me know this is not appropriate, I will remove them asap.

Features

In comparison to the autograder provided by our lovely TA, these scripts use exhaustion on sequential strings, since based on my personal tests, the random strings do not work really well. However, it also contains the random testing code, feel free to use if you find it helpful.


Update: C++ version is also available, this one supports multithreaded testing, which is better for exhausting all possible strings (with some length limit of course). Now it's compiled as a Linux binary that should work on Ubuntu/CSIL systems. See the following part for more details.

How to use

Downloads:

https://sites.cs.ucsb.edu/~tianleyu/CS138/q2a.py

https://sites.cs.ucsb.edu/~tianleyu/CS138/q2b.py

The python files attached are my autograders, please replace the placeholder text with your regex. Do not remove the parenthesis and ^& provided, since they make sure the whole string is totally matched.


C++ version can be downloaded here: https://sites.cs.ucsb.edu/~tianleyu/CS138/q2

Or if you are using csil, you can copy it from here:

cp /cs/student/tianleyu/public/q2 ./

Or just run it in place using this command:

/cs/student/tianleyu/public/q2

Please note that this version is designed to run the regex tests on a huge scale, please first make sure it worked for most of the cases using the python version.

Regarding setting the thread number: The best choice of thread number is the number of your CPU cores (x2 if hyperthreading is enabled) this value should be 8 if you are running on csil.

Limitations

This script was originally written in javascript and later migrated to C++. I translated this final version to python so everybody should be able to use it easily, but some functions inside of it might appear stupid. Please feel free to change it. This is my personal work and has no implication of how the official autograder will be. It might contain errors and bugs, and I am not responsible for any consequences produced by using these scripts.

GLHF