top of page

Developers need to move fast

We understand that in order to ship products as fast as possible developers put all their focus on writing code. Documentation and unit tests are not at the top of their priority list

Automatic Code Documentation

Automatic Unit test generation

Scroll for examples

Python

def is_valid_email(email):

    return re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', email) != None

"""  AI GENERATED
This function checks if an email is valid.

Args:
    email (str): The email to be checked.

Returns:
    bool: True if the email is valid, False otherwise.
"""

AI GENERATED

import unittest

class TestIsValidEmail(unittest.TestCase):
    def test_is_valid_email(self):
        # test valid emails
        self.assertTrue(is_valid_email("test@test.com"))
        self.assertTrue(is_valid_email("test@test.co.uk"))
        self.assertTrue(is_valid_email("test@test.org"))
        # test invalid emails
        self.assertFalse(is_valid_email("test"))
        self.assertFalse(is_valid_email("test@"))
        self.assertFalse(is_valid_email("@test"))
        self.assertFalse(is_valid_email("test.com"))
        self.assertFalse(is_valid_email("test@test"))

if __name__ == '__main__':
    unittest.main()

Java

public bool checkIsEmailValid(String email){

     regex = "^(.+)@(.+)$";

     Pattern pattern = Pattern.compile(regex);

     Matcher matcher = pattern.matcher(email);

     return matcher.matches();

}

/** AI GENERATED

 * Checks if a given String is a valid email address

 * @param email the String to check

 * @return true if the String is a valid email, false otherwise

*/

/** * AI GENERATED Unit test for checkIsEmailValid */

@Test public void testCheckIsEmailValid() {

      String validEmail = "test@test.com";

      String invalidEmail = "test@test";

      assertTrue(checkIsEmailValid(validEmail));

      assertFalse(checkIsEmailValid(invalidEmail));

}

Solidity

function isValidEmail(string memory _email) internal view returns (bool) {

        if (bytes(_email).length == 0)

             return false;

        bytes memory bEmail = bytes(_email);

        if (bEmail.length < 7 || bEmail[bEmail.length - 5] != 0x40)

             return false;

        return true;

}

/** AI GENERATED

 * @dev Checks if the given string is a valid email address

 * @param _email The email address to check

 * @return True if the email address is valid, false otherwise */

// Unit test AI GENERATED

contract  TestEmailValidator {

        function testValidEmail() {

             EmailValidator validator = new EmailValidator();

            Assert.isTrue(validator.isValidEmail("name@domain.com"), "Email should be valid");

       }

        function testInvalidEmail() {

            EmailValidator validator = new EmailValidator();

            Assert.isFalse(validator.isValidEmail(""), "Email should be invalid");

      }

}

Want to integrate?

Thanks for reaching out! We'll get back to you :)

bottom of page