diff test/parser.tst @ 20624:7c0e10f035bd

Extend parser to accept binary constants that begin with '0b' or '0B'. * NEWS: Announce change: * lex.ll: Define NUMBIN to be 0[bB] followed by 0,1, or '_'. Define NUMBER to be NUMREAL|NUMHEX|NUMBIN. *lex.ll (looks_like_bin): New function to detect 0[bB] prefix. *lex.ll (handle_numbe): Call looks_like_bin() and if found then convert binary string to double. * parser.tst: Add tests for new behavior.
author Rik <rik@octave.org>
date Fri, 09 Oct 2015 18:52:58 -0700
parents e34692daf663
children
line wrap: on
line diff
--- a/test/parser.tst	Mon Oct 05 14:05:58 2015 -0700
+++ b/test/parser.tst	Fri Oct 09 18:52:58 2015 -0700
@@ -282,6 +282,11 @@
 %!assert (0xAB_CD, 43981)
 %!assert (2e0_1, 20);
 
+## Test binary constants
+%!assert (0b101, 5)
+%!assert (0B1100_0001, 0xC1)
+%!assert (class (0b1), "double")
+
 ## Test creation of anonymous functions
 
 %!test