Skip to content

Commit

Permalink
[mojo-stdlib] Updated imports in utils tests
Browse files Browse the repository at this point in the history
Signed-off-by: Kaushal Phulgirkar <[email protected]>
  • Loading branch information
StandinKP committed Mar 30, 2024
1 parent 762bf3a commit a44b036
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion stdlib/test/test_utils/__init__.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#
# ===----------------------------------------------------------------------=== #

from .test_utils import *
from .test_utils import libm_call
from .types import CopyCounter, MoveCounter, MoveOnly
3 changes: 1 addition & 2 deletions stdlib/test/test_utils/types.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ struct MoveCounter[T: CollectionElement](CollectionElement):
var move_count: Int

fn __init__(inout self, owned value: T):
"""Construct a new instance of this type. This initial move is not counted.
"""
"""Construct a new instance of this type. This initial move is not counted."""
self.value = value^
self.move_count = 0

Expand Down
12 changes: 3 additions & 9 deletions stdlib/test/utils/test_tuple.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,13 @@ def test_static_int_tuple():
"(-3, -3, -3, -3)",
)

assert_equal(
str(StaticIntTuple[2](10, 11) // StaticIntTuple[2](3, 4)), "(3, 2)"
)
assert_equal(str(StaticIntTuple[2](10, 11) // StaticIntTuple[2](3, 4)), "(3, 2)")

# Note: index comparison is intended for access bound checking, which is
# usually all-element semantic, i.e. true if true for all positions.
assert_true(
StaticIntTuple[5](1, 2, 3, 4, 5) < StaticIntTuple[5](4, 5, 6, 7, 8)
)
assert_true(StaticIntTuple[5](1, 2, 3, 4, 5) < StaticIntTuple[5](4, 5, 6, 7, 8))

assert_false(
StaticIntTuple[4](3, 5, -1, -2) > StaticIntTuple[4](0, 0, 0, 0)
)
assert_false(StaticIntTuple[4](3, 5, -1, -2) > StaticIntTuple[4](0, 0, 0, 0))

assert_equal(len(StaticIntTuple[4](3, 5, -1, -2)), 4)

Expand Down
6 changes: 2 additions & 4 deletions stdlib/test/utils/test_variant.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sys.ffi import _get_global

from memory.unsafe import Pointer
from testing import *
from testing import assert_equal, assert_false, assert_true

from utils.variant import Variant

Expand All @@ -38,9 +38,7 @@ struct TestCounter(CollectionElement):


fn _poison_ptr() -> Pointer[Bool]:
var ptr = _get_global[
"TEST_VARIANT_POISON", _initialize_poison, _destroy_poison
]()
var ptr = _get_global["TEST_VARIANT_POISON", _initialize_poison, _destroy_poison]()
return ptr.bitcast[Bool]()


Expand Down

0 comments on commit a44b036

Please sign in to comment.