Skip to content

Commit 7a35398

Browse files
committed
Update readme with info about unit tests
1 parent c57cbe4 commit 7a35398

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ to detect the bounding box of a Sudoku puzzle given an image from a newspaper or
77
goes on to solve the puzzle and show the solution.
88

99
It works pretty well but the OpenCV.js file is very big. I have managed to get it down to about 4 MB from 8 MB by
10-
exlcuding some bits that I am not using. However, it occurred to me that if I could move the bounding box code
10+
excluding some bits that I am not using. However, it occurred to me that if I could move the bounding box code
1111
from JavaScript to C++ and then build it as a WebAssembly, the overall result might be smaller.
1212

1313
> **UPDATE:** This isn't the final version of the code but results so far are encouraging - my
@@ -67,7 +67,7 @@ npm run build:wasm
6767

6868
# Running
6969

70-
This assumes that you have already cloned and built OpenCV as described above.
70+
The following sections assume that you have already cloned and built OpenCV as described above.
7171

7272
## Running a local server
7373

@@ -100,6 +100,28 @@ This will automatically rebundle when a change is made to files of type .js, .ht
100100
If you change a C++ source file, you will have to explicitly re-run `npm run build:wasm`.
101101
The resulting WebAssembly should then be automatically rebundled.
102102

103+
# Unit Tests
104+
105+
I have added a single unit test so far. This can be run from the command line or a web browser
106+
(inspired by chapter 13 of [WebAssembly in Action](https://www.manning.com/books/webassembly-in-action)).
107+
108+
The following sections assume that you have already cloned and built OpenCV as described above.
109+
110+
## Running unit tests from the command line
111+
112+
```
113+
npm run build
114+
npm test
115+
```
116+
117+
## Running unit tests from a web browser
118+
119+
```
120+
npm run build
121+
PORT=3434 npm start
122+
open http://localhost:3434/tests.html
123+
```
124+
103125
# Links
104126

105127
* https://github.com/mpizenberg/emscripten-opencv.git

0 commit comments

Comments
 (0)