Skip to content

Commit b8b7c38

Browse files
Updated JavaScript test files.
1 parent 07ac75a commit b8b7c38

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
// ReSharper disable once PossiblyUnassignedProperty
5+
exports.Meta = module.getContext();
6+
7+
exports.Add = function (a, b) {
8+
return a + b;
9+
}
10+
11+
exports.Subtract = function (a, b) {
12+
return a - b;
13+
}
14+
15+
exports.Multiply = function (a, b) {
16+
return a * b;
17+
}
18+
19+
exports.Divide = function (a, b) {
20+
return a / b;
21+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
let Arithmetic = require("../Arithmetic/Arithmetic");
5+
let Self = require("Geometry");
6+
7+
// ReSharper disable once PossiblyUnassignedProperty
8+
exports.Meta = module.getContext();
9+
10+
exports.Rectangle = class {
11+
constructor(width, height) {
12+
this.width = width;
13+
this.height = height;
14+
}
15+
get Area() {
16+
return Self.Rectangle.CalculateArea(this.width, this.height);
17+
}
18+
static CalculateArea(width, height) {
19+
return Arithmetic.Multiply(width, height);
20+
}
21+
}
22+
23+
exports.Square = class extends exports.Rectangle {
24+
constructor(side) {
25+
super(side, side);
26+
}
27+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
let Arithmetic = require("Arithmetic");
5+
let Self = require("Geometry");
6+
7+
// ReSharper disable once PossiblyUnassignedProperty
8+
exports.Meta = module.getContext();
9+
10+
exports.Rectangle = class {
11+
constructor(width, height) {
12+
this.width = width;
13+
this.height = height;
14+
}
15+
get Area() {
16+
return Self.Rectangle.CalculateArea(this.width, this.height);
17+
}
18+
static CalculateArea(width, height) {
19+
return Arithmetic.Multiply(width, height);
20+
}
21+
}
22+
23+
exports.Square = class extends exports.Rectangle {
24+
constructor(side) {
25+
super(side, side);
26+
}
27+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
// ReSharper disable once JsPathNotFound
5+
let Geometry = require("Geometry/Geometry.js");
6+
7+
// ReSharper disable once ReturnFromGlobalScopetWithValue
8+
return new Geometry.Square(25).Area;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
// ReSharper disable once JsPathNotFound
5+
let Geometry = require("Geometry/Geometry");
6+
7+
foo.bar = new Geometry.Square(25).Area;
8+
9+
// ReSharper disable once ReturnFromGlobalScopetWithValue
10+
return foo.bar;

0 commit comments

Comments
 (0)