Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add String::isEmpty()#220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aentinger merged 2 commits intoarduino:masterfromalranel:isempty
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsapi/String.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -89,6 +89,7 @@ class String
// invalid string (i.e., "if (s)" will be true afterwards)
bool reserve(unsigned int size);
inline unsigned int length(void) const {return len;}
inline bool isEmpty(void) const { return length() == 0; }

// creates a copy of the assigned value. if the value is null or
// invalid, or if the memory allocation fails, the string will be
Expand Down
29 changes: 29 additions & 0 deletionstest/src/String/test_isEmpty.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2023 Arduino. All rights reserved.
*/

/**************************************************************************************
* INCLUDE
**************************************************************************************/

#include <catch.hpp>

#include <api/String.h>

#include "StringPrinter.h"

/**************************************************************************************
* TEST CODE
**************************************************************************************/

TEST_CASE ("Testing String::isEmpty when string is empty", "[String-isEmpty-01]")
{
arduino::String str;
REQUIRE(str.isEmpty());
}

TEST_CASE ("Testing String::isEmpty when string contains characters", "[String-isEmpty-02]")
{
arduino::String str("Testing String::isEmpty");
REQUIRE(!str.isEmpty());
}

[8]ページ先頭

©2009-2025 Movatter.jp