Browse Source

Sol Part 55: Now Not A Tautology!

master
Graham Northup 5 years ago
parent
commit
88b6ae1ac4
Signed by: grissess GPG Key ID: 5D000E6F539376FB
  1. 4
      runtime.c
  2. 6
      sol.h
  3. 11
      tests/basic_logic.sol

4
runtime.c

@ -577,7 +577,7 @@ sol_object_t *sol_eval_inner(sol_state_t *state, expr_node *expr, jmp_buf jmp) {
ERR_CHECK(state);
rint = sol_cast_int(state, right);
ERR_CHECK(state);
res = sol_new_int(state, BOOL_TO_INT(lint && rint));
res = sol_new_int(state, BOOL_TO_INT(lint->ival && rint->ival));
sol_obj_free(lint);
sol_obj_free(rint);
break;
@ -587,7 +587,7 @@ sol_object_t *sol_eval_inner(sol_state_t *state, expr_node *expr, jmp_buf jmp) {
ERR_CHECK(state);
rint = sol_cast_int(state, right);
ERR_CHECK(state);
res = sol_new_int(state, BOOL_TO_INT(lint || rint));
res = sol_new_int(state, BOOL_TO_INT(lint->ival || rint->ival));
sol_obj_free(lint);
sol_obj_free(rint);
break;

6
sol.h

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

11
tests/basic_logic.sol

@ -0,0 +1,11 @@
execfile("tests/_lib.sol")
assert_eq(0 || 0, 0, "LOR")
assert_eq(1 || 0, 1, "LOR")
assert_eq(0 || 1, 1, "LOR")
assert_eq(1 || 1, 1, "LOR")
assert_eq(0 && 0, 0, "LAND")
assert_eq(1 && 0, 0, "LAND")
assert_eq(0 && 1, 0, "LAND")
assert_eq(1 && 1, 1, "LAND")
Loading…
Cancel
Save