Commit Graph

16 Commits

Author SHA1 Message Date
Abtin Keshavarzian 9d95a19e52 [tests] use constexpr for constants in unit tests (#13145)
This commit refactors various unit tests to use `constexpr` for
defining constants instead of anonymous `enum` types.

Using `constexpr` is the modern and preferred approach in C++, as it
provides explicit types for constants and improves code clarity and
type safety.
2026-05-25 19:39:27 -07:00
Abtin Keshavarzian 1528c8831d [core] define core/instance folder for instance modules (#9561)
This commit moves the `instance` module to a newly added folder
`core/instance` (from `core/common`.  Header file `extension.hpp`
and its example is also moved to the same folder.
2023-10-26 05:08:24 -07:00
Jonathan Hui 9c467a23ae [clang-format] apply v14 changes (#8490) 2022-12-07 16:23:20 -08:00
Abtin Keshavarzian 57d072d352 [test] enhance {Verify/Success}OrQuit() and their use in unit test (#6764)
This commit updates `VerifyOrQuit()` and `SuccessOrQuit()` macros to
include the failed condition in the error message that is printed on
a failure (in addition to function name and line number where the
error happened). This commit also changes the second parameter
(`aMessage`) to in these macros to be optional.

This commit also updates unit tests to remove the second `aMessage`
string in cases where the failure can be inferred from the condition
itself.
2021-06-28 11:38:10 -07:00
Jonathan Hui 58b0486bcd [clang-format] update to clang-format-10 (#5616) 2020-10-07 21:17:44 -07:00
Simon Lin f5d7f50f44 [tests] ignore otError in spinel tests (#5093) 2020-06-17 10:48:01 -07:00
Jonathan Hui 5b622e690e [typos] fix typos (#4613) 2020-02-28 21:45:04 -08:00
Yakun Xu fb16fd44d7 [build] move hdlc to lib/hdlc (#4590)
This commit moves hdlc from src/ncp to src/lib/hdlc, src/spinel is also
moved to src/lib/spinel.
2020-02-27 08:49:01 -08:00
Yakun Xu 8546bceeab [build] move spinel into src/utils (#4558)
Move spinel from src/ncp into src/utils and remove dependency on
OpenThread's core configurations.
2020-02-19 11:45:35 -08:00
Abtin Keshavarzian eaf2e7b9f7 [unit-test] add a common function to dump buffer content (#4367)
This commit updates `test_utils.hpp/cpp` to include a common helper
function `DumpBuffer` to print the content of a buffer (as hex and char string)
to screen. It also removes unused helper functions and use of STL header
files and types.
2019-12-11 09:16:48 -08:00
Abtin Keshavarzian f10c6c36fd [unit-test] remove (unnecessary) ENABLE_TEST_MAIN definition (#4367) 2019-12-11 09:16:48 -08:00
Jonathan Hui 9d585edc46 [types] move types into specific headers (#2946) 2018-08-08 11:19:41 -07:00
Jonathan Hui 69d98d4a53 [code-style] apply clang-format 2018-02-09 21:43:42 +00:00
Abtin Keshavarzian 02c876ef62 [instance] define ot::Instance class (#2307)
This commit makes the following changes: It defines the public
`otInstance` as an empty opaque structure which is used by all public
C OpenThread APIs. It defines a new class `ot::Instance` (inheriting
from `otInstance) which is then used in core source files. The
functionality related to the instance is also moved/added into the
newly added `Instance` class (as class/static or member methods).
2017-11-13 08:27:57 -08:00
Abtin Keshavarzian 1e6658b3ad [spinel] add support for 64-bit long signed/unsigned integer (#2309)
This commit adds support for encoding/decoding `uint64_t`/`int64_t`
to spinel as primitive types. `X` and `x` are used as format ASCII
character associated with `uint64_t` and `int64_t` respectively.
This commit also updates the `SpinelEncoder` and `SpinelDecoder`
to add methods related to 64-bit long integer. The related unit test
are also updated.
2017-11-01 21:46:09 -07:00
Abtin Keshavarzian 92ba27a1fa [ncp] adding SpinelDecoder class and updating NCP implementation (#2258)
This commit adds a new class `SpinelDecoder` which provides a set of
methods/APIs to help in decoding/reading content using Spinel formating
(it is practically a C++ wrapper over Spinel C APIs). A unit test
`test_spinel_decoder` is also added in this commit.

This commit also updates the `NcpBase` implementation to adopt the new
`SpinelDecoder` class mainly in set, insert, and remove handlers
for different Spinel properties. The new class provides similar advantage
as `SpinelEncoder` by simplifying the handler implementations and adding
type-check safety when parsing/reading the spinel frame.
2017-10-13 09:18:37 -07:00