Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Nov 2, 2024
1 parent eb318e3 commit 1ad7e91
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const tests: ComputeClassTypeForLiteralTypeTest[] = [
},
{
literalType: factory.createLiteralType(new FloatConstant(1.5), new IntConstant(1n)),
expected: coreTypes.Number,
expected: coreTypes.Float,
},
{
literalType: factory.createLiteralType(new IntConstant(1n), new StringConstant('')),
Expand All @@ -78,7 +78,7 @@ const tests: ComputeClassTypeForLiteralTypeTest[] = [
},
{
literalType: factory.createLiteralType(new FloatConstant(1.5), new IntConstant(1n), NullConstant),
expected: coreTypes.Number.withExplicitNullability(true),
expected: coreTypes.Float.withExplicitNullability(true),
},
{
literalType: factory.createLiteralType(new IntConstant(1n), new StringConstant(''), NullConstant),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ search:

- safeds
- lang
- [Int](safeds/lang/Int.md)
- [Float](safeds/lang/Float.md)
- [Number](safeds/lang/Number.md)
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ search:

[//]: # (DO NOT EDIT THIS FILE DIRECTLY. Instead, edit the corresponding stub file and execute `npm run docs:api`.)

# <code class="doc-symbol doc-symbol-class"></code> `Int` {#safeds.lang.Int data-toc-label='[class] Int'}
# <code class="doc-symbol doc-symbol-class"></code> `Float` {#safeds.lang.Float data-toc-label='[class] Float'}

**Parent type:** `#!sds Number`

**Inheritors:**

- `#!sds Int`

??? quote "Stub code in `main.sdsstub`"

```sds linenums="5"
class Int sub Number
class Float sub Number
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ search:
**Inheritors:**

- `#!sds Float`
- `#!sds Int`

??? quote "Stub code in `main.sdsstub`"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package safeds.lang

class Number

class Int sub Number
class Float sub Number
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pipeline myPipeline {
// $TEST$ serialization List<literal<1, 2, 3>>
»[1, 2, 3]«;

// $TEST$ serialization List<Number>
// $TEST$ serialization List<Float>
»[1, float(), 3]«;

// $TEST$ serialization List<Any>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pipeline myPipeline {
// $TEST$ serialization Map<Int, literal<1, 2, 3>>
»{1: 1, 2: 2, 3: 3}«;

// $TEST$ serialization Map<Number, Number>
// $TEST$ serialization Map<Float, Float>
»{1: 1, float(): float(), 3: 3}«;

// $TEST$ serialization Map<Any, Any>
Expand All @@ -20,6 +20,6 @@ pipeline myPipeline {
// $TEST$ serialization Map<Any?, Any?>
»{1: 1, string(): string(), null: null}«;

// $TEST$ serialization Map<Number, String?>
// $TEST$ serialization Map<Float, String?>
»{float(): string(), 1: null}«;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pipeline elvisWithNullableLeftOperand {
»intOrNull() ?: null«;
// $TEST$ serialization Int
»intOrNull() ?: 1«;
// $TEST$ serialization Number
// $TEST$ serialization Float
»intOrNull() ?: 1.0«;
// $TEST$ serialization Any
»intOrNull() ?: ""«;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ segment covariant(
»[coInt, coString]«;
// $TEST$ serialization List<Contravariant<Nothing>>
»[coInt, coFloat]«;
// $TEST$ serialization List<Contravariant<SomeCovariant<Nothing, Boolean>>>
// $TEST$ serialization List<Contravariant<SomeCovariant<Int, Boolean>>>
»[coInt, coFloat2]«;

// $TEST$ serialization List<Contravariant<Covariant<String>>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ segment covariant(
»[coInt, coInt]«;
// $TEST$ serialization List<Covariant<Any>>
»[coInt, coString]«;
// $TEST$ serialization List<Covariant<Number>>
// $TEST$ serialization List<Covariant<Float>>
»[coInt, coFloat]«;

// $TEST$ serialization List<Covariant<String>>
Expand Down Expand Up @@ -88,7 +88,7 @@ segment multiple(
) {
// $TEST$ serialization List<Multiple<Number, Int>>
»[multipleNumberInt, multipleNumberInt]«;
// $TEST$ serialization List<Multiple<Number, Number>>
// $TEST$ serialization List<Multiple<Number, Float>>
»[multipleNumberInt, multipleNumberFloat]«;

// $TEST$ serialization List<Multiple<Number, Float>>
Expand Down

0 comments on commit 1ad7e91

Please sign in to comment.