ETHcode update v0.0.6 — Unit testing solidity with remix-tests

0mkar
7Finney
Published in
2 min readOct 30, 2019

Solidity TDD focused development update. Compile solidity and run unit tests using remix-tests framework.

Install ETHcode from Visual Studio Marketplace. ctrl+alt+e activates the plugin. Press ctrl+alt+c to compile and ctrl+alt+t to run unit tests using ETHcode. Test file names should be like <filename>_test.sol.

SafeMath unit testing

We used safeMath library from OpenZeppelin to perform some unit testing on uint types. More details on safeMath library github.

Import and use safeMath library for arithmetic operations on uint types.

Now all uinttypes will be using SafeMath library.

safeMath Tests

String types unit testing using string utils

We used stringUtils library to perform some unit testing on string types. More details on stringUtils library on github.

First import and use stringUtils for string types.

We will use stringToUint, stringCompare, stringLen, stringConcat functions from stringUtils library for performing various operations on string types.

stringUtils Tests

Bit operators unit testing

We used bits library from ethereum/solidity-examples to perform some unit testing on bits types. More details on bits library on github.

Import & use bits library.

Then our bits types unit tests are as follows

Bits Tests

Full source can be found on our github repo — Click here

Ethcode gitter support channel —https://gitter.im/Ethereum-Devtools-Developers-Studio/ethcode

Help Quanta Network by donating Ethereum — 0xd22fE4aEFed0A984B1165dc24095728EE7005a36

--

--