Pastey EDS: create_table init_records parameters must be equal or greater than MAX_IND

# HG changeset patch
# User Guillermo Bonvehi 
# Date 1391773884 10800
# Node ID 7060430afc6754a91972f55767d0d7c41997d7f1
# Parent  2c379fb63e7481d4e7aa1330b5d4789af612a163
EDS: create_table init_records parameters must be equal or greater than MAX_INDEX

diff -r 2c379fb63e74 -r 7060430afc67 include/std/eds.e
--- a/include/std/eds.e Wed Jan 29 11:00:14 2014 -0500
+++ b/include/std/eds.e Fri Feb 07 08:51:24 2014 -0300
@@ -1609,10 +1609,10 @@
                return DB_EXISTS_ALREADY
        end if
 
-       if init_records < 1 then
-               init_records = 1
+       if init_records < MAX_INDEX then
+               init_records = MAX_INDEX
        end if
-       init_index = math:min({init_records, MAX_INDEX})
+       init_index = MAX_INDEX
        
        -- increment number of tables
        io:seek(current_db, TABLE_HEADERS)
diff -r 2c379fb63e74 -r 7060430afc67 tests/t_database.e
--- a/tests/t_database.e        Wed Jan 29 11:00:14 2014 -0500
+++ b/tests/t_database.e        Fri Feb 07 08:51:24 2014 -0300
@@ -372,6 +372,27 @@
 end procedure
 test_dump()
 
+procedure test_create_table_init_records()
+       sequence the_db = "create_table_init_records.edb"
+       sequence test_table
+       db_fatal_id = routine_id( "db_fatal_error" )
+       db_close()
+       if file_exists( the_db ) then
+               delete_file( the_db )
+       end if
+       test_equal( "create " & the_db, DB_OK, db_create( the_db ) )
+       for i = 0 to 10 do
+               test_table = sprintf( "table%d", i )
+               test_equal( "create " & the_db & " " & test_table, DB_OK, db_create_table( test_table, i ) )
+               for h = 0 to 10 do
+                       db_insert( sprintf( "dummy%d", h ), {h, "data"} )
+               end for
+               db_clear_table( test_table )
+       end for
+       db_close()
+       delete_file( the_db )
+end procedure
+test_create_table_init_records()
 
 
 test_report()