[gnumeric] sstest: warn about volatile cells.



commit 59149680e929b5c898951f9151f22c915d8ba100
Author: Morten Welinder <terra gnome org>
Date:   Sun Jul 12 17:31:48 2020 -0400

    sstest: warn about volatile cells.
    
    This test is mostly meaningless if a cell contains =rand().

 src/sstest.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/sstest.c b/src/sstest.c
index 21d6fbfc6..55c6fe759 100644
--- a/src/sstest.c
+++ b/src/sstest.c
@@ -3519,9 +3519,15 @@ test_recalc (GOCmdContext *cc, const char *url)
        WORKBOOK_FOREACH_SHEET (wb, sheet, {
                GPtrArray *scells = sheet_cells (sheet, NULL);  
                unsigned ui;
-               for (ui = 0; ui < scells->len; ui++)
-                       g_ptr_array_add (cells, g_ptr_array_index (scells, ui));
-               });
+               for (ui = 0; ui < scells->len; ui++) {
+                       GnmCell *cell = g_ptr_array_index (scells, ui);
+                       g_ptr_array_add (cells, cell);
+                       if (gnm_cell_has_expr (cell) &&
+                           gnm_expr_top_is_volatile (cell->base.texpr))
+                               g_printerr ("NOTE: %s!%s is volatile.\n",
+                                           cell->base.sheet->name_unquoted,
+                                           cell_name (cell));
+               }});
        base_values = get_cell_values (cells);
 
        g_printerr ("Changing the contents of %d cells, one at a time...\n", cells->len);
@@ -3562,9 +3568,12 @@ test_recalc (GOCmdContext *cc, const char *url)
                        if (value_equal (val1, val2))
                                continue;
 
-                       g_printerr ("When changing %s!%s:\b", cell_name (cell));
-                       g_printerr ("  Value of %s before: %s\n", cell_name (cell2), value_peek_string 
(val1));
-                       g_printerr ("  Value of %s after : %s\n", cell_name (cell2), value_peek_string 
(val2));
+                       g_printerr ("When changing %s!%s:\n",
+                                   cell->base.sheet->name_unquoted, cell_name (cell));
+                       g_printerr ("  Value of %s!%s before: %s\n",
+                                   cell2->base.sheet->name_unquoted, cell_name (cell2), value_peek_string 
(val1));
+                       g_printerr ("  Value of %s!%s after : %s\n",
+                                   cell2->base.sheet->name_unquoted, cell_name (cell2), value_peek_string 
(val2));
                        g_printerr ("\n");
                }
                g_ptr_array_unref (values);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]