IDEA-76599 Quickfix to change a double literal to a float literal

This commit is contained in:
anna
2012-02-10 14:15:09 +01:00
parent 992515d681
commit cb0442de53
16 changed files with 225 additions and 1 deletions
@@ -0,0 +1,7 @@
// "Convert '1e1' to float" "true"
class Test {
void bar() {
foo(1e1f);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '2.' to float" "true"
class Test {
void bar() {
foo(2.f);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '.3' to float" "true"
class Test {
void bar() {
foo(.3f);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '0.0' to float" "true"
class Test {
void bar() {
foo(0.0f);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '3.14' to float" "true"
class Test {
void bar() {
foo(3.14f);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '1e1' to float" "true"
class Test {
void bar() {
foo(1e<caret>1);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '2.' to float" "true"
class Test {
void bar() {
foo(2<caret>.);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '.3' to float" "true"
class Test {
void bar() {
foo(.<caret>3);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '0.0' to float" "true"
class Test {
void bar() {
foo(0<caret>.0);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '3.14' to float" "true"
class Test {
void bar() {
foo(3<caret>.14);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '1e-9d' to float" "false"
class Test {
void bar() {
foo(1e-9<caret>d);
}
void foo(float f){}
}
@@ -0,0 +1,7 @@
// "Convert '1e137' to float" "false"
class Test {
void bar() {
foo(1e1<caret>37);
}
void foo(float f){}
}
@@ -0,0 +1,29 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.daemon.quickFix;
/**
* @author cdr
*/
public class ConvertDoubleToFloatFixTest extends LightQuickFix15TestCase {
public void test() throws Exception { doAllTests(); }
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/convertDoubleToFloat";
}
}