Commit Graph

179 Commits

Author SHA1 Message Date
Michael Tautschnig f4ac10d26c Silence warning about unused local symbol
This is intentional in this test.
2018-11-10 12:30:31 +00:00
Michael Tautschnig 2c37acb294
Merge pull request #3309 from tautschnig/vs-escape
Escape backslash in string representing Windows path [blocks: #2310]
2018-11-10 12:07:39 +00:00
Michael Tautschnig dd0f46de1e clang-format compatible indent of preprocessor directives 2018-11-10 11:07:06 +00:00
Michael Tautschnig 34e895411e Escape backslash in string representing Windows path 2018-11-10 10:30:19 +00:00
Michael Tautschnig 9f4fcb03c0 Remove unused left-hand side e2
The subsequent steps intentionally use `find` instead of using the available
reference.
2018-11-10 10:29:43 +00:00
Michael Tautschnig b541bf94a9 Use numeric_cast<mp_integer> instead of deprecated to_integer(exprt), part 2
This further reduces the number of warnings flagged, in particular in
Visual-Studio builds. Also turn tests of the size of ID_vector types being
constants into invariants as was already done in some places.
2018-11-05 19:27:14 +00:00
Michael Tautschnig 2ff4d2fe86 Generalise get_subexpression_at_offset to extract parts of members
This enables re-use in the simplifier and other places. Adding a unit test of
get_subexpression_at_offset.
2018-10-31 13:10:48 +00:00
Michael Tautschnig 42c6746fde Fix typo in simplify_byte_extract
As the comment says, only simplify when byte_extract_id() matches the current
configuration (and not on a mismatch!). Added a unit test as it isn't entirely
obvious what regression tests may produce such expressions.
2018-10-14 09:22:32 +00:00
Michael Tautschnig 7f002faa9e Move Java-independent expression simplifier unit tests
Test that are unrelated to Java bytecode should be performed as part of the
top-level unit tests. This is a preparation step for adding further unit tests.
2018-10-14 09:19:45 +00:00
Chris Smowton 1225b77165 Add unit test for cmdlinet::has_option 2018-10-02 17:16:36 +01:00
Michael Tautschnig 660772a2e3
Merge pull request #3036 from hannes-steffenhagen-diffblue/feature-div_exprt_accessors
Feature div exprt accessors
2018-09-25 19:22:43 +01:00
Hannes Steffenhagen de87842422 Add accessors for div_exprt operands 2018-09-25 15:29:14 +01:00
Michael Tautschnig 02707cbbba
Merge pull request #3030 from tautschnig/format-number-range
Rewrite format_number_range
2018-09-24 22:12:24 +01:00
Michael Tautschnig 70d1a85804 Unit test for format_number_range
format_number_range was not being tested in isolation before.
2018-09-24 13:46:41 +00:00
Michael Tautschnig 187430e34c clang-format whitespace cleanup around recently changed lines
Whitespace change only.
2018-09-21 09:35:46 +00:00
Michael Tautschnig 867fb02d86 Do not use redundant comparison with true or false
We generally don't do so, and using it in selected places is an unnecessary
surprise to the (code) reader.
2018-09-21 09:35:00 +00:00
Michael Tautschnig 92fc16d9cd replace_symbolt must consider all non-lvalues
Literal constants are not the only ones: for example, address-of isn't an lvalue
either. Make is_lvalue globally available to accomplish this.
2018-08-31 13:33:27 +00:00
Michael Tautschnig 9b62514c88 replace_symbolt: Check type consistency 2018-08-31 12:38:09 +01:00
Michael Tautschnig 094ebd5a6c Refactor lvalue-retainment in replace_symbolt into a separate class 2018-08-31 12:38:09 +01:00
Michael Tautschnig 8b4212a6ff Avoid using replace_symbolt::insert(irep_idt, exprt)
All such cases will have a symbol_exprt in the vicinity and thus use
insert(symbol_exprt, exprt) instead.
2018-08-31 09:21:29 +00:00
Daniel Kroening 646a9d802e use split_string that returns its result 2018-08-27 12:44:43 +01:00
Michael Tautschnig e327ef2b1a replace_symbolt: hide {expr,type}_map
Values should only be added via insert. Add expr_map access functions as some
code still does access the expr_map.
2018-08-16 18:08:26 +00:00
Michael Tautschnig c55d032395 Unit test of replace_symbolt 2018-08-16 16:05:05 +00:00
Michael Tautschnig 7f587c4840 Fix concat_dir_file for Windows and unit-test it 2018-08-06 17:53:25 +00:00
Daniel Kroening a43e4fad96 add is_directory to file_util.h 2018-08-04 16:00:29 +01:00
Daniel Kroening 8b51fafb7c fix get_base_name 2018-08-03 14:08:27 +01:00
Daniel Poetzl 4ae8eb6756 Move sharing map friends declarations to unit tests 2018-07-31 14:56:55 +01:00
Daniel Poetzl 186897c0bd Sharing stats for the sharing map 2018-07-31 14:56:50 +01:00
Daniel Poetzl be7e140795 Activate internal checks for the sharing map unit tests 2018-07-31 14:26:03 +01:00
Chris Ryder 9986ea139e Make exprt::is_zero() support bitfields 2018-07-25 17:15:27 +01:00
Michael Tautschnig 0146874c73 Make all unicode operations use native endianness
We do not transfer data to another system, thus using architecture-native
endianness is sufficient.

Fixes: #2559
2018-07-09 23:39:26 +01:00
Michael Tautschnig 8d93087aa4 Move unicode unit test to CATCH and enable it 2018-07-09 23:39:26 +01:00
Nathan Phillips 5acc0b0a5f
Merge pull request #2392 from NathanJPhillips/cleanup/small_map_layout
Add comment explaining unusual layout where body of test is in a function
2018-07-09 16:55:41 +01:00
Chris Smowton deff59df22 Add tests for grapht::make_chordal and grapht::connected_subgraphs 2018-06-27 13:34:57 +01:00
Michael Tautschnig 79ef045994 Deprecate get_unsigned_int
Using "unsigned" is almost always wrong - the type is unrelated to both the
machine type the code is compiled on as well as the width of the platform we are
running an analysis for.

get_unsigned_int specifically was used inconsistently: the same entry (ID_width)
is set via APIs with a parameter of type size_t and several places already used
get_size_t.
2018-06-25 14:03:11 +01:00
Nathan Phillips 3aa9b72d7b Add comment explaining unusual layout 2018-06-22 15:00:55 +01:00
Michael Tautschnig cbce4bc117 Unit test of irept's public API 2018-06-14 09:11:13 +00:00
Nathan Phillips abdb0443f2 Unit test to check that irept implements sharing
Separately test irept and exprt, where the latter are expected to have the very
same behaviour.
2018-06-14 09:11:13 +00:00
Peter Schrammel 103c7b736f Add missing module definitions 2018-06-05 22:55:22 +01:00
Daniel Poetzl af2defdd8a Removed obsolete sharing map unit test 2018-05-23 16:59:38 +01:00
Daniel Poetzl 1d7fbd3c57 Refactor sharing map nodes to reduce memory consumption 2018-05-23 16:59:38 +01:00
Peter Schrammel b6742ca41e Move Java unit tests 2018-05-20 23:00:04 +01:00
Michael Tautschnig 9fe432b2f9
Merge pull request #1899 from danpoe/sharing-map-catch-unit-tests
Document the sharing map, and move sharing map unit tests to catch
2018-05-17 16:21:53 +01:00
Daniel Poetzl a2ad909d83 Small map 2018-05-03 17:29:55 +01:00
Daniel Poetzl 1f661f5d90 Move sharing map and sharing node unit tests to util 2018-04-25 11:21:46 +01:00
Daniel Poetzl 35c4be7867 Small shared two way pointer 2018-04-23 14:23:55 +01:00
Thomas Kiley ad62682758
Merge pull request #2071 from thk123/refactor/split-string-unit-tests
Enhance split_string to support splitting on white space [TG-2922]
2018-04-19 13:24:53 +01:00
thk123 fc8ba88971 Revert to aborting precondition for function inputs 2018-04-19 10:59:50 +01:00
Michael Tautschnig cd45b0b4a0 Test has_subtype on recursive data types
The test fails without the fixes from fe8e58961b.
2018-04-18 14:40:23 +01:00
thk123 a385d9ba94 Allowed split_string to be used on whitespace if not also trying to strip
Also improved comments (and moved to doxygen) as I assumed strip would
remove
whitespace from throughout the string but actually only does the final
string

Replace asserts in string utils

Adding tests for behaviour with whitespace delimiter
2018-04-16 15:40:50 +01:00
thk123 145f474c08 Adding tests for empty string edge cases 2018-04-16 14:18:13 +01:00
thk123 07009d4504 Refactored test to run all combinations 2018-04-16 14:18:12 +01:00
thk123 252c24c893 Migrate old string utils unit tests 2018-04-16 14:18:12 +01:00
Michael Tautschnig e9ebd5998b has_subtype(type, pred, ns) to search for contained type matching pred
This is the counterpart to has_subexpr; the previous local implementation in
string_refinement_util is promoted to expr_util and extended to work with types
that require a namespace lookup.
2018-04-16 11:06:26 +01:00
Nathan Phillips 0902ae7815 Tests to demonstrate expected sharing behaviour of irept 2018-03-28 17:07:26 +01:00
Michael Tautschnig 2239ec1d91 Unit test of irept's public API 2018-03-28 17:00:24 +01:00
Matthias Güdemann d430ddc887 Replace copyright notice with author entry 2018-03-09 16:02:09 +01:00
Matthias Güdemann 631acab5f0 Fix Diffblue author entries 2018-03-09 15:15:21 +01:00
César Rodríguez c480d28a19
Merge pull request #1842 from NathanJPhillips/feature/depth_iterator_get_mutable
Allow non-const depth_iteratort to be created from a const root
2018-02-17 14:53:29 +00:00
Nathan Phillips 416bbe01b0 Allow non-const depth_iteratort to be created from a const root
This allows creation of a non-const depth_iteratort from a const root as long as a function is provided to get a non-const version of the root if/when mutate if finally called.
2018-02-16 18:10:40 +00:00
Nathan Phillips a094990eaf Fixed test name 2018-02-14 16:42:28 +00:00
Kurt Degiorgio 807268e6f4 Fixes the symbol_base_tablet iterator
The iterator for symbol_base_tablet had a missing operator overload
which prevented range-based loops from working

Commit also adds a unit-test
2018-02-08 16:09:34 +00:00
Chris Smowton 3f1fd645b4 Add code_typet::get_parameter_indices
This is simply the opposite of the existing get_parameter_indentifiers,
useful for mapping from parameter identifier to its argument or parameter
index.
2018-01-04 11:36:54 +00:00
Nathan Phillips a2b45e3763 Update to journalling symbol table
Split a common base class out to reduce impact of usage sites
2017-11-15 10:31:40 +00:00
Chris Smowton c3c24e2d98 Add symbol table writer
This wraps a symbol table, providing an interface matching its write side
(but not type-compatible, to avoid implicit casts between the two), and
journals modifcations such that callers can determine what changes were made
by code using this wrapper to add, update and remove symbols
2017-10-18 18:07:24 +01:00
reuk 24f9867b36 Simplify a broader range of java primitive types 2017-10-16 09:47:46 +01:00
Chris Smowton 5fa7b9af3e Merge pull request #1466 from reuk/reuk/return-ptr-from-expr-cast
Return pointer from expr_try_dynamic_cast
2017-10-11 20:42:47 +01:00
reuk 9f53e909d2 Return pointer from expr_try_dynamic_cast 2017-10-11 15:55:15 +01:00
Chris Smowton 78cd286d0b Fix messaget's copy-constructor and operator=
These were broken, leaving an mstreamt whose back-pointer pointed
into a different messaget than the one it enclosed, which could then have
its message_handlert changed with unexpected side-effects, or be deleted
causing a probable segfault on next log message.

The added unit tests verify that this no longer happens.
2017-10-11 14:51:20 +01:00
reuk aacd4367a3 Add new testing-utils library 2017-10-10 10:28:37 +01:00
reuk 1d879289f8 Add unit test for new behavior 2017-10-04 10:47:06 +01:00
reuk 9ea7414f5f Set up config in unit tests 2017-10-04 10:47:06 +01:00
Chris Smowton da4df034ae Switch from pointers to optionalt 2017-09-20 14:44:42 +01:00
Nathan Phillips 96f2d9e51a Added a PRECONDITION assert/invariant
This better matches the existing behaviour
2017-09-19 15:36:49 +01:00
Nathan Phillips de8a8d00c6 Implementation of expr_dynamic_cast 2017-09-19 15:36:47 +01:00
Lukasz A.J. Wrona ae584df67c Move optional unit tests into util directory 2017-09-04 16:15:24 +01:00
Michael Tautschnig 4d35274bd0 Simplify pointer_offset(constant) 2017-09-01 20:12:50 +01:00
Romain Brenguier 5d3771a7ed Adding unit tests for next_sibling_or_parent of an iterator 2017-08-29 10:28:14 +01:00
Lukasz A.J. Wrona 665dd70e65 Implement depth-first search iterators for exprt class
- Implements 3 forward iterators, traversing expression tree by
   exploring each expression's operands() vector using depth-first
   traversal (unique_depth_iteratort, depth_iteratort,
   const_depth_iteratort)
 - Adds exprt member functions for obtaining said iterator
 - Adds unit tests for said iterator
2017-08-07 09:44:33 +01:00