Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions recipes/ExtraMojo/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
context:
version: "0.12.0"
version: "0.13.0"

package:
name: "extramojo"
version: ${{ version }}

source:
- git: https://github.com/ExtraMojo/ExtraMojo.git
rev: 25b6a6e7089138ab93f99d79401c57c8174c38ee
rev: 97c9151d968206581cfd8a1d626c2e5d519046e5

build:
number: 0
Expand Down
51 changes: 28 additions & 23 deletions recipes/ExtraMojo/tests/test_bstr.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from ExtraMojo.bstr.bstr import (
to_ascii_uppercase,
)
from ExtraMojo.bstr.memchr import memchr, memchr_wide
from memory import Span
from testing import *


Expand All @@ -28,30 +27,36 @@ fn s(bytes: Span[UInt8]) -> String:


fn test_memchr() raises:
var cases = List[(StringLiteral, Int)](
(
"enlivened,unleavened,Arnulfo's,Unilever's,unloved|Anouilh,analogue,analogy",
49,
),
(
"enlivened,unleavened,Arnulfo's,Unilever's,unloved,Anouilh,analogue,analogy,enlivened,unleavened,Arnulfo's,Unilever's,unloved|Anouilh,analogue,analogy",
124,
),
)

for kase in cases:
var index = memchr(kase[][0].as_bytes(), ord("|"))
assert_equal(
index,
kase[][1],
"Expected "
+ String(kase[][1])
+ " Found "
+ String(index)
+ " in "
+ kase[][0],
alias check = InlineArray[Bool, 2](True, False)

@parameter
for do_alignment in range(0, len(check)):
var cases = List[(StringLiteral, Int)](
(
"enlivened,unleavened,Arnulfo's,Unilever's,unloved|Anouilh,analogue,analogy",
49,
),
(
"enlivened,unleavened,Arnulfo's,Unilever's,unloved,Anouilh,analogue,analogy,enlivened,unleavened,Arnulfo's,Unilever's,unloved|Anouilh,analogue,analogy",
124,
),
)

for kase in cases:
var index = memchr[do_alignment = check[do_alignment]](
kase[][0].as_bytes(), ord("|")
)
assert_equal(
index,
kase[][1],
"Expected "
+ String(kase[][1])
+ " Found "
+ String(index)
+ " in "
+ kase[][0],
)


fn test_memchr_wide() raises:
var cases = List[(StringLiteral, Int)](
Expand Down
3 changes: 1 addition & 2 deletions recipes/ExtraMojo/tests/test_file.mojo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from collections import Optional, Dict
from collections import Dict
from utils import StringSlice
from memory import Span
from pathlib import Path
from python import Python
from tensor import Tensor
Expand Down