/ Check-in [679eff87]

Overview
Comment: Add a sudoku solver to the recursive query tests in with1.test. Tarball | ZIP archive | SQL archive family | ancestors | descendants | both | files | file ages | folders 679eff8759aa25368b977c0d26b78a9fcd9486f5 drh 2014-01-18 18:33:44
Context
 2014-01-20 14:17 Do not run the tests in with2.test with SQLITE_OMIT_CTE builds. check-in: 8a973912 user: dan tags: trunk 2014-01-18 18:33 Add a sudoku solver to the recursive query tests in with1.test. check-in: 679eff87 user: drh tags: trunk 15:59 Add extra test cases. No changes to code. check-in: d38d485e user: dan tags: trunk
Changes

Changes to test/with1.test.

```   363    363                              ..##+*##########+.++++
364    364                               .......+####....   +
365    365                                    ..+####+.
366    366                                      ..#*..
367    367                                       ....#
368    368                                       +.}}
369    369
370  +# Solve a sudoku puzzle using a recursive query
371  +#
372  +do_execsql_test 8.2 {
373  +  WITH RECURSIVE
374  +    input(sud) AS (
375  +      VALUES('53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79')
376  +    ),
377  +
378  +    /* A table filled with digits 1..9, inclusive. */
379  +    digits(z, lp) AS (
380  +      VALUES('1', 1)
381  +      UNION ALL SELECT
382  +      CAST(lp+1 AS TEXT), lp+1 FROM digits WHERE lp<9
383  +    ),
384  +
385  +    /* The tricky bit. */
386  +    x(s, ind) AS (
387  +      SELECT sud, instr(sud, '.') FROM input
388  +      UNION ALL
389  +      SELECT
390  +        substr(s, 1, ind-1) || z || substr(s, ind+1),
391  +        instr( substr(s, 1, ind-1) || z || substr(s, ind+1), '.' )
392  +       FROM x, digits AS z
393  +      WHERE ind>0
394  +        AND NOT EXISTS (
395  +              SELECT 1
396  +                FROM digits AS lp
397  +               WHERE z.z = substr(s, ((ind-1)/9)*9 + lp, 1)
398  +                  OR z.z = substr(s, ((ind-1)%9) + (lp-1)*9 + 1, 1)
399  +                  OR z.z = substr(s, (((ind-1)/3) % 3) * 3
400  +                          + ((ind-1)/27) * 27 + lp
401  +                          + ((lp-1) / 3) * 6, 1)
402  +           )
403  +    )
404  +  SELECT s FROM x WHERE ind=0;
405  +} {534678912672195348198342567859761423426853791713924856961537284287419635345286179}
406  +
370    407   finish_test

```