Browse Source

Sol Part 55: Now Not A Tautology!

Graham Northup 5 years ago
parent
commit
88b6ae1ac4
Signed by: Grissess <grissess@nexusg.org> GPG Key ID: 5D000E6F539376FB
3 changed files with 16 additions and 5 deletions
  1. 2
    2
      runtime.c
  2. 3
    3
      sol.h
  3. 11
    0
      tests/basic_logic.sol

+ 2
- 2
runtime.c View File

@@ -577,7 +577,7 @@ sol_object_t *sol_eval_inner(sol_state_t *state, expr_node *expr, jmp_buf jmp) {
577 577
 					ERR_CHECK(state);
578 578
 					rint = sol_cast_int(state, right);
579 579
 					ERR_CHECK(state);
580
-					res = sol_new_int(state, BOOL_TO_INT(lint && rint));
580
+					res = sol_new_int(state, BOOL_TO_INT(lint->ival && rint->ival));
581 581
 					sol_obj_free(lint);
582 582
 					sol_obj_free(rint);
583 583
 					break;
@@ -587,7 +587,7 @@ sol_object_t *sol_eval_inner(sol_state_t *state, expr_node *expr, jmp_buf jmp) {
587 587
 					ERR_CHECK(state);
588 588
 					rint = sol_cast_int(state, right);
589 589
 					ERR_CHECK(state);
590
-					res = sol_new_int(state, BOOL_TO_INT(lint || rint));
590
+					res = sol_new_int(state, BOOL_TO_INT(lint->ival || rint->ival));
591 591
 					sol_obj_free(lint);
592 592
 					sol_obj_free(rint);
593 593
 					break;

+ 3
- 3
sol.h View File

@@ -10,7 +10,7 @@
10 10
 #include "dsl/dsl.h"
11 11
 
12 12
 /** The version of the project, as made available through `debug.version`. */
13
-#define VERSION "0.2a2"
13
+#define VERSION "0.2a3"
14 14
 /** The hexadecimal version of the project, formatted 0xAAIIRPP where:
15 15
  * 
16 16
  * - AA is the two-digit major version
@@ -18,9 +18,9 @@
18 18
  * - R is 'A' for alpha, 'B' for beta, 'C' for candidate, and 'F' for final
19 19
  * - PP is the two-digit patch
20 20
  *
21
- * This value is guaranteed to always increase by revision.
21
+ * This value is guaranteed to only monotonically increase by revision.
22 22
  */
23
-#define HEXVER 0x0002A02
23
+#define HEXVER 0x0002A03
24 24
 
25 25
 #ifndef SOL_ICACHE_MIN
26 26
 /** The smallest integer to cache. */

+ 11
- 0
tests/basic_logic.sol View File

@@ -0,0 +1,11 @@
1
+execfile("tests/_lib.sol")
2
+
3
+assert_eq(0 || 0, 0, "LOR")
4
+assert_eq(1 || 0, 1, "LOR")
5
+assert_eq(0 || 1, 1, "LOR")
6
+assert_eq(1 || 1, 1, "LOR")
7
+
8
+assert_eq(0 && 0, 0, "LAND")
9
+assert_eq(1 && 0, 0, "LAND")
10
+assert_eq(0 && 1, 0, "LAND")
11
+assert_eq(1 && 1, 1, "LAND")

Loading…
Cancel
Save