>>>>> processing C:\Programs\Octave\Octave-4.1.0+_w64VE\share\octave\4.1.0+\etc\tests\libinterp\dldfcn\xtextscan.tst ***** test b = [10:10:100]; b = [b; 8*b/5]; str = sprintf ("%g miles/hr = %g kilometers/hr\n", b); fmt = "%f miles/hr = %f kilometers/hr"; c = xtextscan (str, fmt); assert (c{1}, b(1,:)', 1e-5); assert (c{2}, b(2,:)', 1e-5); !!!!! test failed ASSERT errors for: assert (c {2},b (2, :)',1e-5) Location | Observed | Expected | Reason (1) 6 16 Abs err 10 exceeds tol 1e-005 (2) 2 32 Abs err 30 exceeds tol 1e-005 (3) 8 48 Abs err 40 exceeds tol 1e-005 (4) 4 64 Abs err 60 exceeds tol 1e-005 (5) 0 80 Abs err 80 exceeds tol 1e-005 (7) 12 112 Abs err 100 exceeds tol 1e-005 (8) 28 128 Abs err 100 exceeds tol 1e-005 (9) 44 144 Abs err 100 exceeds tol 1e-005 (10) 60 160 Abs err 100 exceeds tol 1e-005 Hmmm, must be errors in xtextscan, eats first char of numeric field following a literal I get: >> c c = { [1,1] = 10 20 30 40 50 60 70 80 90 100 [1,2] = 6 2 8 4 80 96 12 28 44 60 } ==================================================================== ***** test c = xtextscan ("L1\nL2", "%s"); assert (c{:}, {"L1"; "L2"}); !!!!! test failed ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason [] L L1 Strings don't match ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason [] L L2 Strings don't match Remark: test OK if run manually - might be a FAIL in assert.m (assert.m always has a FAIL on MINGW with __run_test_suite__ ) I get: >> c c = { [1,1] = { [1,1] = L [2,1] = L } } ==================================================================== ***** test c = xtextscan ("L1\nL2", "%s", "endofline", ""); assert (int8 (c{:}{:}), int8 ([ 76, 49, 10, 76, 50 ])); !!!!! test failed Invalid call to int8. Correct usage is: -- Built-in Function: int8 (X) Remark: put square braces arounc c{:}{:} and do uint8() (chars correspond to unsigned ints AFAIK). Then I get: >> uint8([c{:}{:}]) ans = 76 49 10 76 50 ==================================================================== ***** test b = [10:10:100]; b = [b; 8*b/5; 8*b*1000/5]; str = sprintf ("%g miles/hr = %g (%g) kilometers (meters)/hr\n", b); str = [str "110 miles/hr"]; fmt = "%f miles%s %s %f (%f) kilometers %*s"; c = xtextscan (str, fmt, "collectoutput", 1); assert (size (c{1}), [11, 1]); assert (size (c{3}), [11, 2]); assert (size (c{2}), [11, 2]); assert (c{3}(end), NaN); assert (c{2}{11, 1}, "/hr"); assert (isempty (c{2}{11, 2}), true); !!!!! test failed ASSERT errors for: assert (size (c {1}),[11, 1]) Location | Observed | Expected | Reason (1) 31 11 Abs err 20 exceeds tol 0 I get: >> c c = { [1,1] = 10 6000 NaN NaN NaN NaN 30 8000 NaN NaN NaN NaN 50 0 NaN NaN NaN NaN 70 12000 NaN NaN NaN NaN 90 44000 NaN NaN NaN NaN [1,2] = { [1,1] = / [2,1] = ) [3,1] = [4,1] = )/ [5,1] = [6,1] = [7,1] = / [8,1] = ) [9,1] = [10,1] = )/ [11,1] = [12,1] = [13,1] = / [14,1] = ) [15,1] = [16,1] = )/ [17,1] = [18,1] = [19,1] = / [20,1] = ) [21,1] = [22,1] = )/ [23,1] = [24,1] = [25,1] = / [26,1] = ) [27,1] = [28,1] = )/ [29,1] = [30,1] = [1,2] = [2,2] = ilom [3,2] = m [4,2] = [5,2] = = [6,2] = [7,2] = [8,2] = ilom [9,2] = m [10,2] = [11,2] = = [12,2] = [13,2] = [14,2] = ilom [15,2] = m [16,2] = [17,2] = = [18,2] = [19,2] = [20,2] = ilom [21,2] = m [22,2] = [23,2] = = [24,2] = [25,2] = [26,2] = ilom [27,2] = m [28,2] = [29,2] = = [30,2] = } [1,3] = NaN 6 NaN NaN NaN NaN 20 NaN 2 2000 NaN NaN NaN 8 NaN NaN NaN NaN 40 NaN 4 4000 NaN NaN NaN 80 NaN NaN NaN NaN 60 NaN 6 6000 NaN NaN NaN 12 NaN NaN NaN NaN 80 NaN 28 28000 NaN NaN NaN 44 NaN NaN NaN NaN 100 NaN 60 60000 NaN NaN } ==================================================================== ***** test str = 'First "the second called ""the middle""" third'; fmt = "%q"; c = xtextscan (str, fmt); assert (c{1}, {"First"; 'the second called "the middle"'; "third"}); !!!!! test failed ASSERT errors for: assert (c {1},{"First"; 'the second called "the middle"'; "third"}) Location | Observed | Expected | Reason . O(8x1) E(3x1) Dimensions don't match I get: c = { [1,1] = { [1,1] = F [2,1] = [3,1] = [4,1] = [5,1] = the second called "the middle" [6,1] = [7,1] = [8,1] = [9,1] = } } ==================================================================== ***** test f = tempname (); fid = fopen (f, "w+"); fprintf (fid, " 1 2 3 4\n5 6 7 8"); fseek (fid, 0, "bof"); A = xtextscan (fid, ""); E = feof (fid); fclose (fid); unlink (f); assert (A{1}, [1 ; 5], 1e-6); assert (A{2}, [2 ; 6], 1e-6); assert (A{3}, [3 ; 7], 1e-6); assert (A{4}, [4 ; 8], 1e-6); assert (E); !!!!! test failed ASSERT errors for: assert (A {2},[2; 6],1e-6) Location | Observed | Expected | Reason (1) 3 2 Abs err 1 exceeds tol 1e-006 (2) 7 6 Abs err 1 exceeds tol 1e-006 I get: >> A A = { [1,1] = 1 5 [1,2] = 2 7 [1,3] = 3 NaN [1,4] = NaN NaN } ==================================================================== ***** test C = xtextscan ("123.123", "%3f %3f %3f"); assert (C{1}, 123); assert (C{2}, 0.12, 1e-11); assert (C{3}, 3); !!!!! test failed ASSERT errors for: assert (C {3},3) Location | Observed | Expected | Reason () NaN 3 'NaN' mismatch I get: >> C C = { [1,1] = 123 [1,2] = 0.12000 [1,3] = NaN } ==================================================================== ***** test assert (xtextscan ("12e12", "%4f"), {[120; 2]}); assert (xtextscan ("12e+12", "%5f"), {[120; 2]}); assert (xtextscan ("125e-12","%6f"), {[12.5; 2]}); !!!!! test failed ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason . O(1x1) E(2x1) Dimensions don't match I get: >> xtextscan ("125e-12","%6f") ans = { [1,1] = 12.5000 2.0000 } ==================================================================== ***** test ar = "abcdefguvwxAny\nacegxyzTrailing\nJunk"; C = xtextscan (ar, "%[abcdefg] %*[uvwxyz] %s"); assert (C{1}, {"abcdefg"; "aceg"; ""}); assert (C{2}, {"Any"; "Trailing"; "Junk"}); !!!!! test failed ASSERT errors for: assert (C {1},{"abcdefg"; "aceg"; ""}) Location | Observed | Expected | Reason . O(5x1) E(3x1) Dimensions don't match I get: >> C C = { [1,1] = { [1,1] = abcdefg [2,1] = aceg [3,1] = a [4,1] = [5,1] = } [1,2] = { [1,1] = ny [2,1] = T [3,1] = l [4,1] = ng [5,1] = Jun } } ==================================================================== ***** test assert (xtextscan ("A2 B2 C3", "%*[ABC]%d", 3), {int32([2; 2; 3])}); !!!!! test failed ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason . O(2x1) E(3x1) Dimensions don't match >> xtextscan ("A2 B2 C3", "%*[ABC]%d", 3) ans = { [1,1] = 0 0 } ==================================================================== ***** test br = "abcdefguvwx1Any\nacegxyz2Trailing\n3Junk"; C = xtextscan (br, "%[abcdefg] %*[^0123456789] %s"); assert (C{1}, {"abcdefg"; "aceg"; ""}); assert (C{2}, {"1Any"; "2Trailing"; "3Junk"}); !!!!! test failed ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason [] aceg Strings don't match ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason [] a Strings don't match I get: >> C C = { [1,1] = { [1,1] = abcdefg [2,1] = [3,1] = a [4,1] = } [1,2] = { [1,1] = [2,1] = T [3,1] = J [4,1] = } } ==================================================================== ***** test C = xtextscan ("-i -in -inf -infinity", "%f %f%s %f %f %s"); assert (C, {-i, -i, {"n"}, -Inf, -Inf, {"inity"}}); !!!!! test failed ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason [] ini inity Strings don't match I get: >> C = xtextscan ("-i -in -inf -infinity", "%f %f%s %f %f %s") C = { [1,1] = 0 - 1i [1,2] = 0 - 1i [1,3] = { [1,1] = n } [1,4] = -Inf [1,5] = -Inf [1,6] = { [1,1] = n } }==================================================================== ***** test C = xtextscan ("+i +in +inf +infinity", "%f %f%s %f %f %s", "ExpChars", "eE"); assert (C, {i, i, {"n"}, Inf, Inf, {"inity"}}); !!!!! test failed ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason [] ini inity Strings don't match I get: C = { [1,1] = 0 + 1i [1,2] = NaN [1,3] = { [1,1] = n } [1,4] = Inf [1,5] = 0 + Infi [1,6] = { [1,1] = n } } ==================================================================== ***** test C = xtextscan ("1 2\t3 4", '%f %[^\t] %f %f'); assert (C, {1, {"2"}, 3, 4}); !!!!! test failed ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason [] 3 4 2 Strings don't match ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason () NaN 3 'NaN' mismatch ASSERT errors for: assert (cond {i},expected {i},tol) Location | Observed | Expected | Reason () NaN 4 'NaN' mismatch I get: C = { [1,1] = 1 [1,2] = { [1,1] = 3 4 } [1,3] = NaN [1,4] = NaN } ==================================================================== ***** test a = "-1e90 "; b = "1e90 "; fmt = "%d8 %d16 %d32 %d64 %u8 %u16 %u32 %u64 "; C = xtextscan ([a a a a a a a a b b b b b b b b], fmt); assert (C{1}, int8 ([-128; 127])); assert (C{2}, int16([-32768; 32767])); assert (C{3}, int32([-2147483648; 2147483647])); assert (C{4}, int64([-9223372036854775808; 9223372036854775807])); assert (C{5}, uint8 ([0; 255])); assert (C{6}, uint16([0; 65535])); assert (C{7}, uint32([0; 4294967295])); assert (C{8}, uint64([0; 18446744073709551615])); !!!!! test failed ASSERT errors for: assert (C {1},int8 ([-128; 127])) Location | Observed | Expected | Reason . O(3x1) E(2x1) Dimensions don't match . I get: >> C C = { [1,1] = -128 0 0 [1,2] = -32768 0 0 [1,3] = -2147483648 0 0 [1,4] = -9223372036854775808 0 0 [1,5] = 0 0 0 [1,6] = 0 0 0 [1,7] = 0 0 0 [1,8] = 0 0 0 } ==================================================================== ***** test f = tempname (); fid = fopen (f, "w+"); fprintf (fid,"09/12/2005 Level1 12.34 45 1.23e10 inf Nan Yes 5.1+3i\n"); fprintf (fid,"10/12/2005 Level2 23.54 60 9e19 -inf 0.001 No 2.2-.5i\n"); fprintf (fid,"11/12/2005 Level3 34.90 12 2e5 10 100 No 3.1+.1i\n"); fseek (fid, 0, "bof"); C = xtextscan(fid,"%s %s %f32 %d8 %u %f %f %s %f"); %assert (C{1}, {"09/12/2005";"10/12/2005";"11/12/2005"}); assert (C{2}, {"Level1";"Level2";"Level3"}); assert (C{3}, [single(12.34);single(23.54);single(34.90)]); assert (C{4}, [int8(45);int8(60);int8(12)]); assert (C{5}, [uint32(4294967295);uint32(4294967295);uint32(200000)]); assert (C{6}, [inf;-inf;10]); assert (C{7}, [NaN;0.001;100]); assert (C{8}, {"Yes";"No";"No"}); assert (C{9}, [5.1+3i;2.2-0.5i;3.1+0.1i]); fseek (fid, 0, "bof"); C = xtextscan(fid,"%s Level%d %f32 %d8 %u %f %f %s %f"); assert (C{2}, [int32(1);int32(2);int32(3)]); assert (C{3}, [single(12.34);single(23.54);single(34.90)]); fseek (fid, 0, "bof"); C = xtextscan(fid,'%s %*[^\n]'); fclose (fid); unlink (f); assert (C, {{"09/12/2005";"10/12/2005";"11/12/2005"}}); !!!!! test failed ASSERT errors for: assert (C {2},{"Level1"; "Level2"; "Level3"}) Location | Observed | Expected | Reason . O(7x1) E(3x1) Dimensions don't match I get: >> C C = { [1,1] = { [1,1] = 09/ [2,1] = inf [3,1] = / [4,1] = . [5,1] = } [1,2] = { [1,1] = [2,1] = N [3,1] = 005 [4,1] = -.5i [5,1] = } [1,3] = NaN NaN NaN 11 NaN [1,4] = 5 0 24 0 0 [1,5] = 0 5 60 2 0 [1,6] = 1.2340e+001 + 0.0000e+000i 0.0000e+000 + 3.0000e+000i 9.0000e+019 + 0.0000e+000i NaN + 0.0000e+000i NaN + 0.0000e+000i [1,7] = 45.00000 + 0.00000i 10.00000 + 0.00000i -Inf + 0.00000i 5.00000 + 0.00000i 0.10000 + 0.10000i [1,8] = { [1,1] = . [2,1] = / [3,1] = 0.00 [4,1] = Level [5,1] = } [1,9] = 3.0000e+010 2.0000e+000 NaN 3.4900e+001 NaN }