Skip to content

Commit

Permalink
change aliases, add test cases
Browse files Browse the repository at this point in the history
Makes changes as a result of running over the standard library. Changes
some aliases to less common sequences. Adds test cases.

Updates #3 #9
  • Loading branch information
mmcloughlin committed Feb 5, 2020
1 parent 05d6b3a commit a44aa23
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
14 changes: 14 additions & 0 deletions format_test.go
Expand Up @@ -91,6 +91,20 @@ func TestFormulaNoChange(t *testing.T) {
"be called when the vector facility is available. Implementation in asm_s390x.s.", // subscript "_s"
"[1] http://csrc.nist.gov/publications/drafts/fips-202/fips_202_draft.pdf", // subscript "_202"
"Cert generated by ssh-keygen OpenSSH_6.8p1 OS X 10.10.3", // subscript "_6"

// Standard library.
" x, ok := <-c",
" // \"->\" == 2",

// Unhanded cases.
// "------------------+--------+-----------+----------",
// "Look for //gdb-<tag>=(v1,v2,v3) and print v1, v2, v3",
// "====================================================",
// ` * UNC paths (e.g \\server\share\foo\bar)`,
// ` * absolute paths (e.g C:\foo\bar)`,
// ` * relative paths begin with drive letter (e.g C:foo\bar, C:..\foo\bar, C:.., C:.)`,
// ` * relative paths begin with '\' (e.g \foo\bar)`,
// ` * relative paths begin without '\' (e.g foo\bar, ..\foo\bar, .., .)`,
}
for _, input := range cases {
AssertFormulaOutput(t, input, input)
Expand Down
6 changes: 3 additions & 3 deletions make_symbols.go
Expand Up @@ -47,12 +47,12 @@ var generators = map[string]Generator{
var aliasmap = map[string]string{
"+-": `\pm`,
"-+": `\mp`,
"==": `\equiv`,
"===": `\equiv`,
"<=": `\leqslant`,
">=": `\geqslant`,
"||": `\parallel`,
"<-": `\leftarrow`,
"->": `\rightarrow`,
"<--": `\leftarrow`,
"-->": `\rightarrow`,
"|->": `\mapsto`,
}

Expand Down
6 changes: 3 additions & 3 deletions symbols.md
Expand Up @@ -20,12 +20,12 @@
| Code | Char | Command | Character Name |
| ---:|:---:| --- | --- |
| [`00B1`](https://decodeunicode.org/U+00B1) | `±` | `+-` | |
| [`2190`](https://decodeunicode.org/U+2190) | `` | `<-` | |
| [`2192`](https://decodeunicode.org/U+2192) | `` | `->` | |
| [`2190`](https://decodeunicode.org/U+2190) | `` | `<--` | |
| [`2192`](https://decodeunicode.org/U+2192) | `` | `-->` | |
| [`21A6`](https://decodeunicode.org/U+21A6) | `` | `\|->` | |
| [`2213`](https://decodeunicode.org/U+2213) | `` | `-+` | MINUS-OR-PLUS SIGN |
| [`2225`](https://decodeunicode.org/U+2225) | `` | `\|\|` | |
| [`2261`](https://decodeunicode.org/U+2261) | `` | `==` | |
| [`2261`](https://decodeunicode.org/U+2261) | `` | `===` | |
| [`2A7D`](https://decodeunicode.org/U+2A7D) | `` | `<=` | LESS-THAN OR SLANTED EQUAL TO |
| [`2A7E`](https://decodeunicode.org/U+2A7E) | `` | `>=` | GREATER-THAN OR SLANTED EQUAL TO |

Expand Down
4 changes: 2 additions & 2 deletions testdata/p256.in
Expand Up @@ -211,7 +211,7 @@ var p256Precomputed = [p256Limbs * 2 * 15 * 2]uint32{

// nonZeroToAllOnes returns:
// 0xffffffff for 0 < x <= 2^31
// 0 for x == 0 or x > 2^31.
// 0 for x === 0 or x > 2^31.
func nonZeroToAllOnes(x uint32) uint32 {
return ((x - 1) >> 31) - 1
}
Expand Down Expand Up @@ -372,7 +372,7 @@ func p256ReduceDegree(out *[p256Limbs]uint32, tmp [17]uint64) {
// by adding multiplies of p without affecting the value.
//
// So we eliminate limbs from right to left. Since the bottom 29 bits of p
// are all ones, then by adding tmp2[0]*p to tmp2 we'll make tmp2[0] == 0.
// are all ones, then by adding tmp2[0]*p to tmp2 we'll make tmp2[0] === 0.
// We can do that for 8 further limbs and then right shift to eliminate the
// extra factor of R.
for i := 0; ; i += 2 {
Expand Down
10 changes: 5 additions & 5 deletions testdata/poly1305.in
Expand Up @@ -177,15 +177,15 @@ func updateGeneric(state *macState, msg []byte) {
// h2 h1 h0 \times
// r1 r0 =
// ----------------
// h2r0 h1r0 h0r0 <- individual 128-bit products
// h2r0 h1r0 h0r0 <-- individual 128-bit products
// + h2r1 h1r1 h0r1
// ------------------------
// m3 m2 m1 m0 <- result in 128-bit overlapping limbs
// m3 m2 m1 m0 <-- result in 128-bit overlapping limbs
// ------------------------
// m3.hi m2.hi m1.hi m0.hi <- carry propagation
// m3.hi m2.hi m1.hi m0.hi <-- carry propagation
// + m3.lo m2.lo m1.lo m0.lo
// -------------------------------
// t4 t3 t2 t1 t0 <- final result in 64-bit limbs
// t4 t3 t2 t1 t0 <-- final result in 64-bit limbs
//
// The main difference from pen-and-paper multiplication is that we do
// carry propagation in a separate step, as if we wrote two digit sums
Expand Down Expand Up @@ -263,7 +263,7 @@ const (
maskNotLow2Bits uint64 = ^maskLow2Bits
)

// select64 returns x if v == 1 and y if v == 0, in constant time.
// select64 returns x if v === 1 and y if v === 0, in constant time.
func select64(v, x, y uint64) uint64 { return ^(v-1)&x | (v-1)&y }

// [p0, p1, p2] is 2^130 - 5 in little endian order.
Expand Down
6 changes: 3 additions & 3 deletions zsymbols.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a44aa23

Please sign in to comment.