Skip to content

Commit df1cefe

Browse files
committed
27 tests passing
1 parent dc809f3 commit df1cefe

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

topics/about_asserts.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
module("About Asserts (topics/about_asserts.js)");
33

44
test("ok", function() {
5-
ok(__, 'what will satisfy the ok assertion?');
5+
ok(true, 'what will satisfy the ok assertion?');
66
});
77

88
test("not", function() {
9-
not(__, 'what is a false value?');
9+
not(false, 'what is a false value?');
1010
});
1111

1212
test("equals", function() {
13-
equals(1+1, __, 'what will satisfy the equals assertion?');
13+
equals(1+1, 2, 'what will satisfy the equals assertion?');
1414
});

topics/about_assignment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
module("About Assignment (topics/about_assignment.js)");
33

44
test("local variables", function() {
5-
var temp = __;
5+
var temp = 1;
66
equals(1, temp, "Assign a value to the variable temp");
77
});
88

99
test("global variables", function() {
1010
temp = 1;
11-
equals(temp, window.__, 'global variables are assigned to the window object');
11+
equals(temp, window.temp, 'global variables are assigned to the window object');
1212
});

topics/about_control_structures.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ test("if", function() {
66
if (2 > 0) {
77
isPositive = true;
88
}
9-
equals(isPositive, __, 'what is the value of isPositive?');
9+
equals(isPositive, true, 'what is the value of isPositive?');
1010
});
1111

1212
test("for", function() {
1313
var counter = 10;
1414
for (var i = 1; i <= 3; i++) {
1515
counter = counter + i;
1616
}
17-
equals(counter, __, 'what is the value of counter?');
17+
equals(counter, 16, 'what is the value of counter?');
1818
});
1919

2020
test("for in", function() {
@@ -25,18 +25,18 @@ test("for in", function() {
2525
};
2626
var result = "";
2727
// for in enumerates the property names of an object
28-
for (property_name in person) {
29-
result = result + property_name;
30-
};
31-
equals(result, __, 'what is the value of result?');
28+
for (var property_name in person) {
29+
result = result + property_name;
30+
}
31+
equals(result, "nameage", 'what is the value of result?');
3232
});
3333

3434
test("ternary operator", function() {
3535
var fruit = true ? "apple" : "orange";
36-
equals(fruit, __, 'what is the value of fruit?');
36+
equals(fruit, "apple", 'what is the value of fruit?');
3737

3838
fruit = false ? "apple" : "orange";
39-
equals(fruit, __, 'now what is the value of fruit?');
39+
equals(fruit, "orange", 'now what is the value of fruit?');
4040
});
4141

4242
test("switch", function() {
@@ -49,7 +49,7 @@ test("switch", function() {
4949
result = 2;
5050
break;
5151
}
52-
equals(result, __, 'what is the value of result?');
52+
equals(result, 2, 'what is the value of result?');
5353
});
5454

5555
test("switch default case", function() {
@@ -65,10 +65,10 @@ test("switch default case", function() {
6565
result = "Merry";
6666
break;
6767
}
68-
equals(result, __, 'what is the value of result?');
68+
equals(result, "Merry", 'what is the value of result?');
6969
});
7070

7171
test("null coallescion", function() {
7272
var result = null || "a value";
73-
equals(result, __, 'what is the value of result?');
73+
equals(result, "a value", 'what is the value of result?');
7474
});

topics/about_equality.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
module("About Equality (topics/about_equality.js)");
33

44
test("numeric equality", function() {
5-
equals(3 + __, 7, 'hmmmm?');
5+
equals(3 + 4, 7, 'hmmmm?');
66
});
77

88
test("string equality", function() {
9-
equals("3" + __, "37", "concatenate the strings");
9+
equals("3" + 7, "37", "concatenate the strings");
1010
});
1111

1212
test("equality without type coercion", function() {
13-
ok(3 === __, 'what is exactly equal to 3?');
13+
ok(3 === 3, 'what is exactly equal to 3?');
1414
});
1515

1616
test("equality with type coercion", function() {
17-
ok(3 == "__", 'what string is equal to 3, with type coercion?');
17+
ok(3 == "3", 'what string is equal to 3, with type coercion?');
1818
});
1919

2020
test("string literals", function() {
21-
equals("frankenstein", '__', "quote types are interchangable, but must match.");
21+
equals("frankenstein", 'frankenstein', "quote types are interchangable, but must match.");
2222
});

topics/about_operators.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test("addition", function() {
77
for (var i = 0; i <= 5; i++) {
88
result = result + i;
99
}
10-
equals(result, __, "What is the value of result?");
10+
equals(result, 15, "What is the value of result?");
1111
});
1212

1313
test("assignment addition", function() {
@@ -16,23 +16,23 @@ test("assignment addition", function() {
1616
//the code below is just like saying result = result + i; but is more concise
1717
result += i;
1818
}
19-
equals(result, __, "What is the value of result?");
19+
equals(result, 15, "What is the value of result?");
2020
});
2121

2222
test("subtraction", function() {
2323
var result = 5;
2424
for (var i = 0; i <= 2; i++) {
2525
result = result - i;
2626
}
27-
equals(result, __, "What is the value of result?");
27+
equals(result, 2, "What is the value of result?");
2828
});
2929

3030
test("assignment subtraction", function() {
3131
var result = 5;
3232
for (var i = 0; i <= 2; i++) {
3333
result -= i;
3434
}
35-
equals(result, __, "What is the value of result?");
35+
equals(result, 2, "What is the value of result?");
3636
});
3737

3838
//Assignment operators are available for multiplication and division as well
@@ -43,5 +43,5 @@ test("modulus", function() {
4343
var x = 5;
4444
//again this is exactly the same as result = result % x
4545
result %= x;
46-
equals(result, __, "What is the value of result?");
46+
equals(result, 0, "What is the value of result?");
4747
});

topics/about_truthyness.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ module("About Truthyness (topics/about_truthyness.js)");
33

44
test("truthyness of positive numbers", function() {
55
var oneIsTruthy = 1 ? true : false;
6-
equals(oneIsTruthy, __, 'is one truthy?');
6+
equals(oneIsTruthy, true, 'is one truthy?');
77
});
88

99
test("truthyness of negative numbers", function() {
1010
var negativeOneIsTruthy = -1 ? true : false;
11-
equals(negativeOneIsTruthy, __, 'is -1 truthy?');
11+
equals(negativeOneIsTruthy, true, 'is -1 truthy?');
1212
});
1313

1414
test("truthyness of zero", function() {
1515
var zeroIsTruthy = 0 ? true : false;
16-
equals(zeroIsTruthy, __, 'is 0 truthy?');
16+
equals(zeroIsTruthy, false, 'is 0 truthy?');
1717
});
1818

1919
test("truthyness of null", function() {
2020
var nullIsTruthy = null ? true : false;
21-
equals(nullIsTruthy, __, 'is null truthy?');
21+
equals(nullIsTruthy, false, 'is null truthy?');
2222
});

0 commit comments

Comments
 (0)